-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Sourcemaps are broken in 0.8.0 (works fine in 0.7.2) when using with Vue SFC options api. #194
Comments
I had the same trouble.It is resolved in 0.8.7. but there are still problems when debug, |
i had the same trouble in tsx files. |
Actually found the issue! Seems to be simple. on 0.7.2 it worked, because there was "sourcemap:" option in config that defaulted to false. And actually, you don't really need sourcemaps with this plugin, because it puts all injected imports into single line. on 0.8.0 onwards, there is no "sourcemap" option, and plugin always generates sourcemaps with (I don't think issue is in magic-string library - rather, somewhere in vite's sourcemaps merging logic) BTW, exactly same problem was found in unplugin-vue-components. UPD: After further investigation, So, I'm proposing following fix:
I can create PR if you agree |
@leo-buneev I had the same problem. Maybe antfu didn't notice this issue, you should PR directly |
I had the same problem,even i upgrade vite to 4.0 ,unplugin-auto-import unplugin-vue-components to newleast version debugger code position is still wrong:( |
Yup, broken in both auto-import and components. How do people live without sourcemaps? They tell you exactly where the problem is... I'll probably have to migrate away from both of these plugins, unfortunately. |
@leo-buneev Did you ever manage to resolve this issue? I see some things were merged since but the issue still persists for me. |
I've fixed it for my project in a fork. It's not kept up-to-date, though. https://github.com/leo-buneev/unplugin-auto-import.git In the end my solution was to not generate sourcemaps from plugin whatsoever. It's (obviously) fastest, and the only downside - transformed code shouldn't add new lines.
|
if you have Vue SFC, and use options Api, and somewhere in <script> section use identifier that should be auto-imported, source maps will break.
Repro: https://stackblitz.com/edit/vite-zrayd3?file=src/App.vue
Click the button and look at reported line in browser console.
This worked before transition to
unimport
- i.e. in 0.7.2The text was updated successfully, but these errors were encountered: