-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dev sourcemap #8269
fix: dev sourcemap #8269
Conversation
In dev mode, if sourcemaps aren't needed should we force not generate them? Currently they are still generated based on the build config |
in dev mode vite just make the default value in build option vite/packages/vite/src/node/build.ts Lines 209 to 274 in 03b227e
and in build mode vite will load the user config. vite/packages/vite/src/node/build.ts Lines 423 to 451 in 03b227e
|
The user could set On the side, I'm not familiar with sourcemaps myself and it seems a bit weird to disable in dev mode 😬 |
yep, it safe. Because vite only load the user build option when mode === 'build' |
I still don't quite understand though (and sorry for the noise), but if I put And if I revert the change in this PR (except for the test), it still seem to pass. Maybe I'm missing something here but if you can show how to reproduce the issue, that we be really helpful for me to understand the issue. |
oh sorry, I misunderstood. You are right, I think we should force set build.sourcemap: false in dev mode 👍. Later I found out that the default value is overridden with a user parameter :p vite/packages/vite/src/node/build.ts Lines 209 to 274 in 03b227e
you can setting |
Just a note, that a sourcemap is required when one would like to debug the script in their IDE, since the imports and some other parts of the code is manipulated by vite before serving preventing the IDE to properly match it to the source files. See #7767 for details. Apparently it affects JetBrains IDE's as well as VisualCode and probably others as well. |
Description
in dev mode, we don't need to generate sourcemap, if generate a sourcemap will point to a null file.
this PR will clean
importGlob
anddynamicImport
generate sourcemap in dev.Additional context
config.build had value when mode === 'build'
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).