unplugin-vue-components icon indicating copy to clipboard operation
unplugin-vue-components copied to clipboard

this plugin destroy sourcemap.

Open joker77877 opened this issue 2 years ago • 35 comments

When using this plugin, I can't normally debugging in chrome. For example, I can't set breakpoint at below position: image

reproduce repositiory: https://github.com/joker77877/vue3-ts-eslint/blob/master/src/components/HelloWorld.vue

joker77877 avatar Nov 17 '21 10:11 joker77877

yes! me too

mrgulc avatar Nov 24 '21 09:11 mrgulc

Can you solve it quickly? It will affect code debugging.

joker77877 avatar Dec 08 '21 06:12 joker77877

me too

gaopengpian avatar Dec 21 '21 11:12 gaopengpian

Same issue.

smallp avatar Jan 11 '22 07:01 smallp

please fix it

gaopengpian avatar Jan 11 '22 08:01 gaopengpian

I have solved this problem. Add build: { sourcemap: true, }, to vite.config.js and it should work fine. This plugin depends this config to generate sourcemap. BTW, need to disable cache after changing the setting.

smallp avatar Jan 12 '22 08:01 smallp

@smallp this doesn't help me. I have latest version of vite (2.7.13), vite-plugin-vue2 (1.9.3) and unplugin-vue-components (0.17.14), build.sourcemap is set to true in vite config, but I still get incorrect source map: image There should be imports of vuetify components (v-container, v-row, etc)

Djaler avatar Jan 27 '22 08:01 Djaler

@smallp this doesn't help me. I have latest version of vite (2.7.13), vite-plugin-vue2 (1.9.3) and unplugin-vue-components (0.17.14), build.sourcemap is set to true in vite config, but I still get incorrect source map: image There should be imports of vuetify components (v-container, v-row, etc)

You dont have to set build.sourcemap now. Try again and give me a sample if it still cannot work.

smallp avatar Feb 09 '22 03:02 smallp

@smallp try this https://github.com/Djaler/unplugin-vue-components-vite-source-map-bug

  1. npm install
  2. npm run build
  3. npm run preview
  4. open http://localhost:4173/
  5. open devtools -> sources -> src/App.vue

As you can see, we can place debugger only on line 16. Also, if you click button on page, you'll stop on line 16, while debugger statement present on line 20 image

Djaler avatar Feb 10 '22 13:02 Djaler

@Djaler Yes, the source map of build result is wrong. But you can use npm run dev. That works fine.

smallp avatar Feb 11 '22 02:02 smallp

Sure, but I need correct maps in production, because of Sentry

Djaler avatar Feb 11 '22 05:02 Djaler

Sure, but I need correct maps in production, because of Sentry

Sorry, I'm not able to help you. I dont know the process of building.

smallp avatar Feb 12 '22 09:02 smallp

Sure, but I need correct maps in production, because of Sentry

can you set breakpoint in your project? i clone your project, then click the button, console out put "could not load the sourcemap 404" image

i'm using vue3 + vite with this plugin, upgrade plugin to latest version. still can not set breakpoint in devtools

zcmk123 avatar Mar 07 '22 08:03 zcmk123

me too

LiuQuanYou avatar Jul 29 '22 02:07 LiuQuanYou

me too

VincentDream avatar Aug 06 '22 03:08 VincentDream

Well, I spent hours and now I know unplugin-vue-components is causing my issue and there is no solution

Mehdi-Hp avatar Sep 21 '22 11:09 Mehdi-Hp

We spent ages trying to figure out the reason debugging was not working in our new project and also finally made this same discovery today. It seems that Composition API code debugging works but not Options API. Is there any potential resolution for this? Thank you.

rezelute avatar Nov 17 '22 14:11 rezelute

We have the same problem + our tests coverage is wrong!

jeddi avatar Dec 02 '22 17:12 jeddi

Same problem here, any updates ?

LoicMonard avatar Dec 07 '22 13:12 LoicMonard

i got same problem

nlvedwin avatar Jan 03 '23 12:01 nlvedwin

Hello i have found a work-around that works for me: add this to vue file:

<script setup>
// work-around https://github.com/antfu/unplugin-vue-components/issues/219
</script>

jeddi avatar Jan 18 '23 10:01 jeddi

Yeah the script setup is working but it's a problem if your whole codebase isn't based on script setup

LoicMonard avatar Feb 02 '23 17:02 LoicMonard

does any one resolve this problem?

superchangme avatar Feb 07 '23 05:02 superchangme

i use <script lang="jsx setup> will apprear this problem

superchangme avatar Feb 07 '23 06:02 superchangme

I fixed this problem a year ago, but I’m not sure which of the following changes took effect.

  1. remove plugin : vite-plugin-vue-setup-extend
  2. vite-plugin-compression : compressPlugin add config :verbose: false
  3. "unplugin-auto-import": "0.5.3" update to 0.5.11

gaopengpian avatar Mar 07 '23 14:03 gaopengpian

so? how to reslove?

galaa2011 avatar Mar 14 '23 05:03 galaa2011

how to reslove? this error afftect developing sence a lot.

Code-terminal avatar Mar 25 '23 08:03 Code-terminal

This is a huge issue, that needs to be fixed... This has been an issue since 2021 and I am surprised there has been no attempt at fixing this. Test coverage being broken is one thing, but source map being broken entirely is even worse, if you have any sort of error tracking, like Sentry, that relies on it... I was quite excited to use this, but seems like it's not worth it

doutatsu avatar Apr 19 '23 09:04 doutatsu

Using this plugin, if the Vue version is greater than 3 and the options syntax is used in the component, the bug of the debugger offset will be reappear!!!

ys3322 avatar May 27 '23 06:05 ys3322

Using this plugin, if the Vue version is greater than 3 and the options syntax is used in the component, the bug of the debugger offset will be reappear!!!

me too

LonelySunset avatar Jun 01 '23 15:06 LonelySunset