- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.7k
 
Description
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?
Self-hosted/on-premise
Which SDK are you using?
@sentry/browser
SDK Version
8.11.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Any
Steps to Reproduce
Scenario A:
- Create new Vite project;
 - Install 
@sentry/browser; - Call 
Sentry.initin code; - Run Vite in dev mode;
 - Open devtools and navigate to Sources/Debugger tabs;
 - Open 
node_modulesfolder. 
Scenario B:
- Create new Vite project;
 - Install 
@sentry/browser; - Call 
Sentry.init; - Add sourcemaps plugin to 
vite.config.ts; - Run Vite build.
 
Expected Result
Scenario A:
Sources for @sentry/core are located in node_modules/@sentry/core folder in Sources/Debugger.
And sources for @sentry/utils are located in node_modules/@sentry/utils folder in Sources/Debugger.
Scenario B:
Build is successful.
Actual Result
Scenario A:
Sources for both @sentry/core and @sentry/utils are mixed and found in different folders. They are found in:
node_modules/src.node_modules/@sentry/src.
Scenario B:
Build fails with error:
Multiple conflicting contents for sourcemap source D:\work\test-widget\node_modules\@sentry\src\envelope.ts
    at getRollupError (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:396:41)
    at error (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:392:42)
    at Link.traceMappings (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17774:32)
    at collapseSourcemaps (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17858:63)
    at transformChunk (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17962:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:18008:17
    at async Promise.all (index 1)
    at async transformChunksAndGenerateContentHashes (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:18003:5)
    at async renderChunks (file:///d:/work/test-widget/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17912:137) {
  code: 'SOURCEMAP_BROKEN'
}
Analysis:
Errors are caused by the content of *.js.map files in published npm packages. Field sources contains extra ../ (to parent folder). As a result, the sources path is mapped outside its own package folder.
Build fails because sources of envelope.js from both @sentry/core and @sentry/utils maps by envelope.map.js to the same path: D:\work\test-widget\node_modules\@sentry\src\envelope.ts.
In order to fix the issue, the path should be ../src/envelope.ts instead of ../../src/envelope.ts or the content of entire packages should be in an additional subfolder.
Metadata
Metadata
Assignees
Labels
Projects
Status


