Skip to content
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

The number of lines that use vite-plugin-style-import to cause debugging to point to errors. #11

Closed
joker77877 opened this issue Mar 23, 2021 · 15 comments
Labels
bug Something isn't working

Comments

@joker77877
Copy link

Chrome's devtool debugger points to wrong locations in source files.

Create new vue-ts project with Vite.

yarn create @vitejs/app my-project --template vue-ts

Add a debugger in source code and run app in Chrome (yarn dev). See breakpoint trigger but pointing at wrong line/location.

521615537511_ pic_hd

In this image, should be pointing at line with debugger;

Repo with reproduction here: https://github.com/joker77877/vite-vue3-sourcemap-issue.git
Run yarn dev and view localhost:3000 in Chrome with devtools open.

@joker77877 joker77877 changed the title The number of lines that use vite-plugin-style-imports to cause debugging to point to errors. The number of lines that use vite-plugin-style-import to cause debugging to point to errors. Mar 23, 2021
@anncwb anncwb added the bug Something isn't working label Mar 23, 2021
@anncwb
Copy link
Collaborator

anncwb commented Mar 24, 2021

I can't find a solution to this problem temporarily

@joker77877
Copy link
Author

image
The number of wrong rows is related to the number of introduced rows

@anncwb
Copy link
Collaborator

anncwb commented Mar 24, 2021

I tried to use magic-string to generate sourcemap, but it still doesn’t work

@joker77877
Copy link
Author

Is it because the sourcemap has been generated before the dependency is introduced?

@anncwb
Copy link
Collaborator

anncwb commented Mar 24, 2021

@joker77877 Try to upgrade to 0.8.2

@anncwb anncwb closed this as completed in 9cfbf9b Mar 24, 2021
@joker77877
Copy link
Author

It doesn't work anymore, there are no load dependencies
image

@joker77877
Copy link
Author

What happened?Version 0.8.1 works well.

@anncwb
Copy link
Collaborator

anncwb commented Mar 24, 2021

This question was automatically closed just now. 0.8.3 restores the 0.8.2 modification

@anncwb anncwb reopened this Mar 24, 2021
@joker77877
Copy link
Author

OK.Looking forward to your repair.

@anncwb anncwb closed this as completed in 31bea61 Mar 26, 2021
@anncwb
Copy link
Collaborator

anncwb commented Mar 26, 2021

@joker77877 Try to upgrade to 0.9.0

@joker77877
Copy link
Author

It works.Thanks.

@joker77877
Copy link
Author

This problem occurs again when upgrading to the latest version.

@WorkHead
Copy link

I occured the same problem, after some research I found that this plugin reads vite config build.sourceMap to determine if it should return sourceMap, see: https://github.com/anncwb/vite-plugin-style-import/blob/80451c1eda1ceee335d8aefaa828c853d7c9a1ea/src/index.ts#L42
And build.sourceMap defaults to false, so this will break the sourceMap by default. Set build.sourceMap to true and everything works fine.

@zzjin
Copy link

zzjin commented Oct 28, 2021

workaround not works for me. build.sourceMap olny works for production not for dev env.

@WorkHead
Copy link

@zzjin try to force restart dev-server. if it still doesn't work, there maybe a problem with another plugin you use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants