Skip to content

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

@janno-p

Description

@janno-p

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions