Skip to content

fix(nuxt): Delete public source maps before Nitro lists its public assets - #25267

Merged
s1gr1d merged 1 commit into
developfrom
sig/JS-3904-nitro-source-maps
Oct 12, 2026
Merged

s1gr1d merged 1 commit into
developfrom
sig/JS-3904-nitro-source-maps

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Oct 12, 2026

Copy link
Copy Markdown
Member

Nitro lists the files in its public dir when it bundles the server. The SDK deleted the client source maps later, in close, so requests for them returned 500 instead of 404.

Now a plugin on Nitro's build deletes them in buildStart. It deletes only matching files in the public dir. Other matches, like server maps, are still deleted in close: the default glob also matches the SSR build's maps, which Nitro needs during its build.

Fixes #25242

@s1gr1d
s1gr1d requested a review from a team as a code owner October 12, 2026 11:17
@s1gr1d
s1gr1d requested review from mydea and nicohrubec and removed request for a team October 12, 2026 11:17
@linear-code

linear-code Bot commented Oct 12, 2026

Copy link
Copy Markdown

JS-3904

@s1gr1d

s1gr1d commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

bugbot run

const rollupConfig = (nitro.options.rollupConfig ??= { output: {} });

rollupConfig.plugins = [
rollupConfig.plugins,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: don't we have to spread it? Or is it automatically flattened?

Suggested change
rollupConfig.plugins,
...rollupConfig.plugins,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not needed as rollup and rolldown flatten nested plugin arrays

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f44da22. Configure here.

@s1gr1d
s1gr1d merged commit 36fdc3f into develop Oct 12, 2026
323 checks passed
@s1gr1d
s1gr1d deleted the sig/JS-3904-nitro-source-maps branch October 12, 2026 12:13
s1gr1d added a commit that referenced this pull request Oct 13, 2026
s1gr1d added a commit that referenced this pull request Oct 13, 2026
This is a copy of `nuxt-4-sourcemaps` for Nuxt 5 (Nitro 3), set up like
`nuxt-5`: it uses the nightly builds and runs as an optional app.

It differs from the Nuxt 4 test in two places:

- **No intermediate client build:** Nuxt 5 writes the client build
straight into `.output/public`. So the check that every client debug ID
was uploaded runs only when the maps are kept.
- **Existing Nuxt 5 bugs:** three assertions are skipped with TODOs, one
for each bug:
  - The server maps have no `sourcesContent`.
  - Files with glob characters in the path are not uploaded.
  - The server maps do not reach the `.vue` files.

Merge after this is merged:
#25267 and
#25287 (CI fix)
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.

@sentry/nuxt: maps removed by filesToDeleteAfterUpload stay in Nitro's public-asset manifest, so /_nuxt/*.js.map returns 500 instead of 404

2 participants