Uh oh!
There was an error while loading. Please reload this page.
fix(nuxt): Windows file:// for import-in-the-middle hook and isAbsolute for C:\ - #23653
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…njection and entry file wrapping
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
On Windows fileURLToPath returns backslash paths (C:\...), so includes('/sentry.server.config') never matched. The config was not marked moduleSideEffects:true and could be tree-shaken, disabling Sentry server init. Normalized paths to forward slashes before the check and keep file:// emission for Node ESM while mapping file:// back to filesystem paths for Rollup.
Fixes handling for both packages/nuxt and packages/solidstart wrapEntry plugins.| // Anything that isn't a relative path is provided by the consuming app or Node at runtime | ||
| // (this covers `@sentry/*`, `nuxt/app`, `#imports`, node builtins), so it stays external. | ||
| const isExternal = id => !id.startsWith('.') && !id.startsWith('/') && !id.startsWith('\0'); | ||
| const isExternal = id => !id.startsWith('.') && !isAbsolute(id) && !id.startsWith('\0'); |
| return { | ||
| name: 'sentry-wrap-entry-with-dynamic-import', | ||
| async resolveId(source, importer, options) { | ||
| if (source.includes(`/${SERVER_CONFIG_FILENAME}`)) { |
There was a problem hiding this comment.
You could probably just do this:
if (path.basename(source).startsWith(SERVER_CONFIG_FILENAME)) {
This does not include the forward slash anymore.
…eview (isAbsolute/basename).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
s1gr1d
left a comment
There was a problem hiding this comment.
Some general comments:
- there are no new tests. Would be great to add unit tests for the new branches in the rollup plugins
- formatting fails: run
yarn formatin the root
| let normalizedSource = source; | ||
| if (source.startsWith('file://')) { | ||
| try { | ||
| normalizedSource = fileURLToPath(source); | ||
| } catch { | ||
| return null; | ||
| } | ||
| } |
There was a problem hiding this comment.
This part is very much the same from the part below where source.startsWith( is checked again.
You could write a util function, e.g.
/** * `load()` emits `file://` specifiers because Node's ESM loader rejects bare Windows * paths (`ERR_UNSUPPORTED_ESM_URL_SCHEME`), but Rollup's resolver only understands * filesystem paths. Returns `undefined` for a malformed `file://` URL. */exportfunctiontoResolvablePath(source: string): {path: string;wasFileUrl: boolean}|undefined{if(!source.startsWith('file://')){return{path: source,wasFileUrl: false};}try{return{path: fileURLToPath(source),wasFileUrl: true};}catch{returnundefined;}}| if (source.startsWith('file://')) { | ||
| const resolved = await this.resolve(normalizedSource, importer, { ...options, isEntry: false }); | ||
| if (resolved) return resolved; | ||
| return { id: normalizedSource }; | ||
| } |
There was a problem hiding this comment.
With the helper util I mentioned above, you could do this here:
if(wasFileUrl){// other code}On Windows, Node's ESM loader rejects bare absolute paths (C:\...) with ERR_UNSUPPORTED_ESM_URL_SCHEME (protocol 'c:'). Emit file:// URLs from wrapEntryWithDynamicImport load hook for the Sentry server config, wrapped entry point, and serverless re-exports. In resolveId, normalize incoming file:// URLs back to filesystem paths via toResolvablePath() and forward them with isEntry: false to prevent double-wrapping. Applied symmetrically to @sentry/nuxt and @sentry/solidstart, with unit tests covering URL normalization and entry resolution.
Uh oh!
There was an error while loading. Please reload this page.
s1gr1d
commented
Sep 1, 2026
Please merge in the changes from develop and resolve the conflicts. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 28367c0. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
s1gr1d
commented
Sep 2, 2026
Some tests are still failing: |
halillusion
commented
Sep 2, 2026
Synced with
|
Uh oh!
There was an error while loading. Please reload this page.
s1gr1d
commented
Sep 3, 2026
I merged develop into your branch to see if CI is green - it works now. Just one little comment as there's a change in the claude file. |
👋 @mydea — Please review this PR when you get a chance! |

Windows fix for Nuxt dev on Node 24.
On Windows
npm run devwas failing withERR_UNSUPPORTED_ESM_URL_SCHEME/Received protocol 'c:'because.nuxt/dev/index.mjsgeneratedimport 'C:\...'instead offile:///C:/.... SameisExternalcheck inrollup.module.config.mjstreatedC:\as external and broke the build.Changed
addServerConfig.ts(and the solidstart copy) to emitpathToFileURL(...).hrefand fixedisExternalto useisAbsolute()so Windows absolute paths work. Also handles POSIX fine.Verified with
yarn nx run @sentry/nuxt:build:dev-> now passes, andpathToFileURLgivesfile:///C:/...on Windows.Closes #XXXX