-
-
Notifications
You must be signed in to change notification settings - Fork 149
Vue Typescript Sourcemaps #272
Comments
Having the same problem. Was going to open an issue for this but saw I’m not the only one. |
This happens in rollup-plugin-vue v5.0 as well. Looks like the problem is with the generated source maps. Running the transpiled js + sourcemap through a visualizers shows that mapping is generated only for a small portion of the code. All inner code inside the objects passed to Vue is ignored in the source map. Not sure if this is a problem with rollup-plugin-vue or with the typescript compiler. Anyway, wasted too much time on this, back to console.logs (seems like it's 20% actual coding and 80% dealing with configuration and debugging the toolchain). |
Did a little more investigating. I was able to work around this by setting This option is not documented anywhere in vue plugin's options and only mentioned in the referenced component-compiler-utils but for some odd reason needs to be passed to the vue plugin directly.
This made the source maps generated correctly again and debugging works inside .vue components. So it does look like a bug in rollup-plugin-vue. |
You're a genius, dude. That worked. It still gives a weird name for the script (adding ?rollup_plugin blah blah blah to the path), but the important thing is that it's now possible to debug. |
It has weird names because this is how rollup-plugin-vue extracts the different parts from the *.vue files (template, script, style) and then feeds them back to rollup as imports so they can be processed by other plugins. You can handle the extracted *.ts then as you like with other plugins, group them together, etc. I wonder what's the status of this project. This bug is over 2 months old and no one paid it any attention. |
where can I put |
This option is passed to rollup-plugin-vue when it's created in rollup's config. I don't think rollup-plugin-vue interacts with vue.config.js. |
Version
4.7.2
Reproduction link
https://github.com/stevethedev/rollup-vue-typescript
Steps to reproduce
git clone https://github.com/stevethedev/rollup-vue-typescript
npm install
npm run start
with-script-typescript.vue
What is expected?
The SourceMap allows a breakpoint to be inserted at Line 12.
What is actually happening?
A breakpoint can only be inserted at lines 1, 3, 6, 7, and 9.
Changing the script
lang
tag from "ts" to "js" causes the SourceMap to behave as expected.The text was updated successfully, but these errors were encountered: