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

Components are unresolved in production build after upgrading to Vite 3+

Open janno-p opened this issue 2 years ago • 7 comments

Describe the bug

After upgrading Vite to 3+ version, component loading is not working any more in production mode (component tags are unresolved in produced output and auto-loaded components are missing from dist files). Everything is working in dev build.

Expected output (from dev build): image

Actual output (from production build): image

Can be reproduced using vite-vue3 example:

yarn build
yarn vite preview

Reproduction

https://github.com/antfu/unplugin-vue-components/tree/cb8f9325ffdaeb74927d823095a30d2ec9a262a9/examples/vite-vue3

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11500H @ 2.90GHz
    Memory: 10.82 GB / 31.73 GB
  Binaries:
    Node: 18.8.0 - ~\scoop\apps\nodejs\current\node.EXE
    Yarn: 1.22.19 - ~\scoop\apps\nodejs\current\bin\yarn.CMD
    npm: 8.18.0 - ~\scoop\apps\nodejs\current\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.70)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

yarn

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

janno-p avatar Sep 01 '22 07:09 janno-p

I have also encountered this problem, and I hope it can be solved

MacOs 12,vite 3.0.2,unplugin-vue-components 0.22.4,vue 3.2.37

shi-lai-mu avatar Sep 08 '22 03:09 shi-lai-mu

how to deal with it.....

sroxck avatar Sep 08 '22 06:09 sroxck

how to deal with it.....

components introduced in markdown files are not parsed

sroxck avatar Sep 08 '22 07:09 sroxck

how to deal with it.....

At the moment the best workaround is probably to downgrade to vite 2.x

cimchd avatar Sep 11 '22 06:09 cimchd

how to deal with it.....

At the moment the best workaround is probably to downgrade to vite 2.x

Some plugins or frameworks are built on 3.x, and we can't downgrade them

shi-lai-mu avatar Sep 11 '22 06:09 shi-lai-mu

me too

liwangyong avatar May 09 '23 08:05 liwangyong

I have also encountered this problem.

kenneth-hao avatar Aug 15 '23 08:08 kenneth-hao