fix(nuxt): Delete source maps after Nitro finishes building - #23407
Open
s1gr1d wants to merge 1 commit into
Open
fix(nuxt): Delete source maps after Nitro finishes building#23407s1gr1d wants to merge 1 commit into
s1gr1d wants to merge 1 commit into
Conversation
s1gr1d
requested review from
chargome and
mydea
and removed request for
a team
August 13, 2026 14:11
Comment on lines
+107
to
+110
| nuxt.hook('close', async () => { | ||
| if (sourceMapsEnabled && !nuxt.options.dev && !nuxt.options?._prepare) { | ||
| await deleteSourceMapsAfterBuild(getPluginOptions(moduleOptions, shouldDeleteFilesFallback)); | ||
| } |
Contributor
There was a problem hiding this comment.
Bug: Source maps are incorrectly deleted when sourcemaps.disable is set to 'disable-upload', preventing manual uploads.
Severity: MEDIUM
Suggested Fix
Update the condition in the close hook to also check if moduleOptions.sourcemaps?.disable is not equal to 'disable-upload'. This will ensure that the source map deletion logic is skipped when this specific setting is used, aligning the behavior with its intended purpose.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/nuxt/src/vite/sourceMaps.ts#L107-L110
Potential issue: When the `sourcemaps.disable` option is set to the string
`'disable-upload'`, the source maps are still deleted after the build process concludes.
The check `moduleOptions.sourcemaps?.disable !== true` in the `close` hook evaluates to
true in this case, which incorrectly triggers the source map deletion logic. This
prevents users from manually uploading the source maps, which is the intended purpose of
the `'disable-upload'` setting. The `deleteArtifacts` function proceeds to delete the
files without any further checks on the `disable` option's value.
Did we get this right? 👍 / 👎 to inform future reviews.
Contributor
size-limit report 📦
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Defer source map deletion until Nuxt’s
closehook, after Nitro has copied public assets into the final output directory.Root cause
The Vite plugin previously deleted source maps from Nuxt’s intermediate client build output. Nitro subsequently copied those assets into the final output, causing the source maps to reappear.
The Vite and Rollup plugins continue to inject debug IDs and upload source maps, but receive options with deletion disabled. Once the complete Nuxt build finishes, the Nuxt integration uses the bundler plugin manager to delete artifacts.
Closes #22801