Environment
Node: v18.16.0
Vite: v5.3.1 (latest)
@sentry/vite-plugin: ^2.20.0
@vitejs/plugin-legacy: ^5.4.1
Project created using npm create vite, and choose React + TypeScript
What version are you running? Etc.
Steps to Reproduce
- Create a new Vite project.
- Config
@vitejs/plugin-legacy.
- Config
sentryVitePlugin, like this:
vite.config.ts:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import legacy from "@vitejs/plugin-legacy";
import { sentryVitePlugin } from "@sentry/vite-plugin";
// https://vitejs.dev/config/
export default defineConfig({
build: {
sourcemap: true,
},
plugins: [
react(),
legacy({
targets: ["defaults", "not IE 11"],
}),
// notice: ... is my private config
sentryVitePlugin({
url: "...",
org: "...",
project: "...",
authToken: "...",
release: {
name: "...",
},
sourcemaps: {
assets: "dist/assets/**",
ignore: ["node_modules"],
filesToDeleteAfterUpload: "dist/**/*.map",
},
}),
],
});
- Add the following to
App.tsx to test:
App.tsx:
// ...
<button
onClick={() => {
throw new Error("VITE SENTRY");
})
}
>
count is {count}
</button>
// ...
Expected Result
The expected result is similar to the second image under the "Actual Result" section.
Actual Result
With the legacy plugin enabled:

Without the legacy plugin:
vite.config.ts:
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import legacy from "@vitejs/plugin-legacy";
import { sentryVitePlugin } from "@sentry/vite-plugin";
// https://vitejs.dev/config/
export default defineConfig({
build: {
sourcemap: true,
},
plugins: [
react(),
// notice: ... is my private config
sentryVitePlugin({
url: "...",
org: "...",
project: "...",
authToken: "...",
release: {
name: "...",
},
sourcemaps: {
assets: "dist/assets/**",
ignore: ["node_modules"],
filesToDeleteAfterUpload: "dist/**/*.map",
},
}),
],
});
This configuration works correctly:

When using the legacy plugin, the build uploads two sourcemaps:

Without the legacy plugin, only one sourcemap is uploaded:

Issue
I need to use the legacy plugin, but it seems incompatible with Sentry sourcemaps. Any help would be appreciated.
Environment
Node:
v18.16.0Vite:
v5.3.1 (latest)@sentry/vite-plugin:
^2.20.0@vitejs/plugin-legacy:
^5.4.1Project created using
npm create vite, and chooseReact + TypeScriptWhat version are you running? Etc.
Steps to Reproduce
@vitejs/plugin-legacy.sentryVitePlugin, like this:vite.config.ts:
App.tsxto test:App.tsx:
Expected Result
The expected result is similar to the second image under the "Actual Result" section.
Actual Result
With the legacy plugin enabled:

Without the legacy plugin:
vite.config.ts:
This configuration works correctly:

When using the legacy plugin, the build uploads two sourcemaps:


Without the legacy plugin, only one sourcemap is uploaded:
Issue
I need to use the legacy plugin, but it seems incompatible with Sentry sourcemaps. Any help would be appreciated.