antfu-collective / vitesse

🏕 Opinionated Vite + Vue Starter Template
https://vitesse.netlify.app/
MIT License
8.79k stars 932 forks source link

Failed to resolve component: Footer with "vite-plugin-components": "0.6.7", #62

Closed frck006 closed 3 years ago

frck006 commented 3 years ago

Hi,

I think there is a problem with vite-plugin-components@0.6.7.

With this version, I lost the "Footer" image

To resolve, change the "package.json" with: -- "vite": "2.0.0-beta.67", -- "vite-plugin-components": "0.6.6", (without the "^" : "^0.6.6" => "0.0.6") => it works.

antfu commented 3 years ago

Did you update the vite.config.ts? alias is moved to resolve.alias.

frck006 commented 3 years ago

Yes I take your template: export default defineConfig({ resolve: { alias: { '~/': ${path.resolve(__dirname, 'src')}/, }, },

greenskybluephish commented 3 years ago

I just cloned the project on my windows machine and I am getting the same error FYI.

image

image

image

antfu commented 3 years ago

Can you run cross-env DEBUG=vite-plugin-components:* pnpm dev and show me the log? Thanks.

greenskybluephish commented 3 years ago

Here you go. I just cloned the project into my wsl shell and it had no issues, so possibly related to the new layouts feature?

Seems like a couple issues have been opened with resolving alias' in Vite. https://github.com/vitejs/vite/issues/2003

image

JohnCampionJr commented 3 years ago

I can duplicate this too. It has something to do with the changes in the component between 0.6.6 and 0.6.7.

Using the main branch (so before layouts) and updating packages to:

"vite": "2.0.0-beta.65",
"vite-plugin-components": "0.6.8",

or

"vite": "2.0.0-beta.69",
"vite-plugin-components": "0.6.8",

Will break this. There is a WIP: HMR commit after 0.6.6 and before 0.6.7. Did you intend to leave that, @antfu ?

antfu commented 3 years ago

Should be fixed in "vite-plugin-components": "^0.6.9", thanks for @JohnCampionJr's help. Can anyone help to confirm this on Windows? Thanks!

frck006 commented 3 years ago

Sorry, no change, the problem is always here: image

I've only done:

npx degit antfu/vitesse my-vitesse-app3 cd my-vitesse-app3 pnpm i pnpm dev

The log from debug:

⚡ Vite dev server running at:

  > Network:  http://192.168.1.89:3333/
  > Local:    http://localhost:3333/
  > Network:  http://100.122.157.156:3333/
  > Network:  http://172.17.158.113:3333/

  ready in 2762ms.

[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at https://github.com/vuejs/rfcs/pull/227.

[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.

  vite-plugin-components:glob started with: [src\components\**\*.{vue,md}] +0ms
  vite-plugin-components:glob 0 components found. +7ms
  vite-plugin-components:context:components add [] +0ms
  vite-plugin-components:context:search {} +0ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/App.vue +0ms
  vite-plugin-components:transform | router-view +0ms
  vite-plugin-components:transform ^ (0) +1ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/App.vue +18ms
  vite-plugin-components:transform | router-view +0ms
  vite-plugin-components:transform ^ (0) +0ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/pages/index.vue +18s
  vite-plugin-components:transform | carbon-campsite +1ms
  vite-plugin-components:transform ^ (1) +1ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/layouts/default.vue +66ms
  vite-plugin-components:transform | router-view +1ms
  vite-plugin-components:transform | Footer +0ms
  vite-plugin-components:transform ^ (0) +0ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/pages/index.vue +53ms
  vite-plugin-components:transform ^ (0) +0ms
  vite-plugin-components:transform C:/Franck/cgid/vuejs3/my-vitesse-app3/src/layouts/home.vue +1s
  vite-plugin-components:transform | router-view +0ms
  vite-plugin-components:transform | Footer +0ms
  vite-plugin-components:transform ^ (0) +0ms
antfu commented 3 years ago

Fixed in vite-plugin-components@0.6.10.

frck006 commented 3 years ago

Yes, I confirm, it works. Thank you. (Think to update package.json)