You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sveltekit build fails with sourcemap deletion enabled #14131
Enable sourcemap deletion in vite.config.ts
Try to build
error during build
Expected Result
Sourcemaps being deleted and the build not failing
Actual Result
error during build:
Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s)oon exit:
on exit:
on exit:
(sentry-file-deletion-plugin) writeBundle
at process.handleBeforeExit (file:///D:/Projects/test/sentry-repro/node_modules/.pnpm/rollup@4.24.3/node_modules/rollup/dist/es/shared/node-entry.js:21098:28)
at Object.onceWrapper (node:events:634:26)
at process.emit (node:events:531:35)
ELIFECYCLE Command failed with exit code 1.
So, I have some preliminary findings but unfortunately no fix yet.
A couple of months ago, we changed how we wait with deleting files until they're fully processed in the @sentry/vite-plugin. Unfortunately, these plugin changes had some side effects in the SvelteKit package because the sentrySvelteKit vite plugin function modifies the @sentry/vite-plugin function quite a lot to make it work with SvelteKit'S build config.
This currently leads to the plugin awaiting a promise that doesn't resolve correctly. I'm gonna debug this a bit more tomorrow and hopefully find a fix.
`[Source Maps Plugin] We recommend setting the \`sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
[Source Maps Plugin] Otherwise, source maps might be deployed to production, depending on your configuration`,
);
For now I made my own vite plugin to remove the maps from the client after build and upload:
Activity
Lms24 commentedon Oct 30, 2024
Hey, thanks for reporting! I'll take a look soon.
dollannn commentedon Nov 9, 2024
Any progress on this?
Lms24 commentedon Nov 11, 2024
Hey, sorry for the wait! Taking a look right now
Lms24 commentedon Nov 11, 2024
So, I have some preliminary findings but unfortunately no fix yet.
A couple of months ago, we changed how we wait with deleting files until they're fully processed in the
@sentry/vite-plugin. Unfortunately, these plugin changes had some side effects in the SvelteKit package because thesentrySvelteKitvite plugin function modifies the@sentry/vite-pluginfunction quite a lot to make it work with SvelteKit'S build config.This currently leads to the plugin awaiting a promise that doesn't resolve correctly. I'm gonna debug this a bit more tomorrow and hopefully find a fix.
dollannn commentedon Dec 8, 2024
Any updates on this?
AbhiPrasad commentedon Dec 9, 2024
Hi @dollannn, currently no updates, but we'll take another look this week!
matthijs166 commentedon Dec 29, 2024
Got the same problem here! I would say this is an important feature.
Also, this should be an option enabled by default (just like in the Next.js plugin with hideSourceMaps and deleteSourcemapsAfterUpload)
Deploying the source map by default in production is not good practice!
Also think the warning it should give is not triggering:
sentry-javascript/packages/sveltekit/src/vite/sourceMaps.ts
Lines 111 to 114 in 4415881
For now I made my own vite plugin to remove the maps from the client after build and upload:
based on: vitejs/vite#12828
Included this in the vite config after the sveltekit plugin:
Lms24 commentedon Jan 2, 2025
Gonna take another look today. Sorry for the wait!
Lms24 commentedon Jan 8, 2025
I opened #14942 to fix this, there will be an automatic response in this issue once the fix is merged and released