sentry-javascript-bundler-plugins: Service Worker "import sentry-release-injection" error when sourcemapping for Sentry (Vite plugin)
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
SDK Version
7.91.0
Framework Version
Vue 3.2.0
Link to Sentry event
No response
SDK Setup
sentryVitePlugin({
org: 'xxxxx',
project: 'xxxxxx',
release: {
name: 'xxxxxx'
}
}),
VitePWA({
registerType: 'prompt',
devOptions: {
enabled: true
},
workbox: {
globPatterns: ['**/*.{js,css,html,ico,png,jpg,jpeg,svg}']
},
manifest: {}
})
})
Steps to Reproduce
- Add sentryVitePlugin and VitePWA plugins on vite.config
- yarn dev
Expected Result
Not having an import sourcemap error
Actual Result
Console: Uncaught SyntaxError: Cannot use import statement outside a module (at dev-sw.js?dev-sw:99:2)
File error:
workbox.precache({})
//# sourceMappingURL=sw.js.map
;import "/@id/__x00__sentry-release-injection-file";
//# sourceMappingURL=xxx
About this issue
- Original URL
- State: open
- Created 6 months ago
- Reactions: 2
- Comments: 16 (8 by maintainers)
I think we are unlikely to do this in the plugi
I think we are unlikely to do that, if you want this you can simply skip adding the plugin in dev yourself, I guess? Or am I missing something there?
I think having an option to ignore certain files for sourcemaps injection is not unreasonable 🤔 I’ll wait for @Lms24 & @lforst to chime in as they know more about the deeper internals of the bundler plugins, though.
Hmm, I guess we could add some kind of
ignoreconfig to skip certain file globs - would that fix your problem? 🤔