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

Wrong component path generated on Windows

Open rafaelytakei opened this issue 4 years ago • 3 comments
trafficstars

Hi, after release v0.16.0 I'm getting the following error after importing a recently created component on Windows, while the dev server is running:

1:38:38 AM [vite] Internal server error: Failed to resolve import "C:UsersAdministratorDocumentsProjectsPersonalannotorious-testsrccomponentsSimpleCard.vue" from 
"src\components\NewTemplate\Modal.vue". Does the file exist?
  Plugin: vite:import-analysis
  File: C:/Users/Administrator/Documents/Projects/Personal/annotorious-test/src/components/NewTemplate/Modal.vue
  1  |  import { defineComponent, ref } from 'vue';/* unplugin-vue-components disabled */import __unplugin_components_7 from 'C:/Users/Administrator/Documents/Projects/Personal/annotorious-test/src/components/MyModal.vue';
  2  |  import __unplugin_components_6 from 'C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\src\components\SimpleCard.vue';
     |                                       ^
  3  |  import __unplugin_components_5 from 'C:/Users/Administrator/Documents/Projects/Personal/annotorious-test/src/components/NewTemplate/LabelList.vue';       
  4  |  import __unplugin_components_4 from 'C:/Users/Administrator/Documents/Projects/Personal/annotorious-test/src/components/MyButton.vue';
      at formatError (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:42206:46)
      at TransformContext.error (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:42202:19)
      at normalizeUrl (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:67247:26)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async TransformContext.transform (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:67387:57)
      at async Object.transform (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:42413:30)
      at async doTransform (C:\Users\Administrator\Documents\Projects\Personal\annotorious-test\node_modules\.pnpm\[email protected]\node_modules\vite\dist\node\chunks\dep-be032392.js:56760:29)

This error gets corrected after I restart the development server. Apparently it's initially generating the paths using \ instead of /

Probably related to the change on PR #167

rafaelytakei avatar Oct 19 '21 04:10 rafaelytakei

i also got this problem if created a new component and import it.

hi-reeve avatar Oct 22 '21 11:10 hi-reeve

Hi, just asking has anyone found a fix for this? Thanks!

larrasu avatar Dec 23 '21 05:12 larrasu

hello,The issue was solved,if you use windows, you can upgrade the plug-in to 0.17.17。See this PR for details 👉 fix(normalizePath): windows to POSIX

markthree avatar Feb 09 '22 09:02 markthree

I'm using 0.22.9 version but the issue is still present

AndrewBogdanovTSS avatar Oct 27 '22 08:10 AndrewBogdanovTSS