ref(nuxt): Use addVitePlugin instead of deprecated vite:extendConfig#19464
ref(nuxt): Use addVitePlugin instead of deprecated vite:extendConfig#19464
addVitePlugin instead of deprecated vite:extendConfig#19464Conversation
addVitePlugin instead of deprecated vite:extendConfig
size-limit report 📦
|
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.
| }), | ||
| // Only add source map plugin during build | ||
| { dev: false, build: true }, | ||
| ); |
There was a problem hiding this comment.
Stale shouldDeleteFilesFallback reference in Vite plugin
High Severity
shouldDeleteFilesFallback is initialized as { client: true, server: true } with let, then reassigned to a new object inside the modules:done hook. However, createSentryViteConfigPlugin is called synchronously before modules:done fires, so it captures a reference to the initial object. When modules:done later reassigns the variable to a new object, the plugin still holds the stale { client: true, server: true } reference. This causes the Vite plugin to always configure fallback source map file deletion, even when users explicitly enabled source maps (where it should be { client: false, server: false }). The old vite:extendConfig hook used a closure reading the variable lazily, so it correctly saw the updated value. The nitro:config hook still works correctly for the same reason.


vite:extendConfigis deprecated, so source maps handling will be done in a plugin which is added withaddVitePluginfrom Nuxt.Also updated the existing tests so they can test the new plugin functionality.
Closes #19345