Skip to content

Conversation

@ph1p
Copy link
Contributor

@ph1p ph1p commented Jan 7, 2026

When a Next.js app uses a basePath (e.g., /dashboard) the proxy.js did not load and shows a 404.
Now its fixed.

@ph1p ph1p changed the title Add basePath option Add basePath flag Jan 7, 2026
@adriaandotcom
Copy link
Collaborator

Thanks a lot!

Is basePath always set up? Aka, do we need a fallback for any version?

@ph1p
Copy link
Contributor Author

ph1p commented Jan 8, 2026

All previous versions should work without changes. The default value of rewrites.basePath is true. The problem occurs with the tag <Script src="/proxy.js"/>. If we define a basePath (e.g., /dashboard), the proxy.js file cannot be found because the path would now have to be /dashboard/proxy.js. To prevent this, we simply set rewrites.basePath to false when a basePath is specified.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 12, 2026

Open in StackBlitz

npm i https://pkg.pr.new/simpleanalytics/next/@simpleanalytics/next@32

commit: 353ac99

@adriaandotcom adriaandotcom merged commit 12f1d36 into simpleanalytics:main Jan 12, 2026
3 checks passed
@adriaandotcom
Copy link
Collaborator

adriaandotcom commented Jan 12, 2026

@ph1p, it's published: https://www.npmjs.com/package/@simpleanalytics/next

Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants