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
[Vue3] build + watch + sourcemap cause rollup conflicting error #35
Comments
Same here :( |
Facing the same issue as described in the report. |
@Chen-jj I found a workaround for this - just use |
Same issue :( watching with sourcemap is not possible currently with vite (?) |
Maybe in vite 5 will be fix for this. I |
Same problem ( |
I don't know if it's related, but there are similar errors even when not in watch mode in certain cases -- specifically for mac and linux platforms. |
Describe the bug
vite build --watch
<template>
ofApp.vue
Multiple conflicting contents for sourcemap source /home/projects/vitejs-vite-4gfbyh/src/App.vue
Every build when rollup calls
addModuleSource
method to process modules, it will figure out should use cache or not:https://github.com/rollup/rollup/blob/27c0557f904321d649c9bd85f6fb670ca5700427/src/ModuleLoader.ts#L271-L275
During the second build which caused by the change of vue
<template>
, module/some_paths/index.vue?vue&type=script&lang.ts
comes inaddModuleSource
method.ButcachedModule.originalCode === sourceDescription.code
is true this time, so rollup uses the cached version of this vue script module.Finally, sourcemap source of module
/some_paths/index.vue?vue&type=script&lang.ts
isold template + old script
, while sourcemap source of module/some_paths/index.vue
isnew template + old script
.Becasue they all have the same sourcefilename but having different source contents, thus the error comes from traceMappings method of rollup:
https://github.com/rollup/rollup/blob/69ff4181e701a0fe0026d0ba147f31bc86beffa8/src/utils/collapseSourcemaps.ts#L87-L89
Reproduction
https://stackblitz.com/edit/vitejs-vite-4gfbyh?file=vite.config.js
System Info
Used Package Manager
pnpm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: