Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"[Vue warn]: Failed to resolve component: van-button" #18

Closed
zhoufenfens opened this issue Jan 6, 2023 · 4 comments
Closed

"[Vue warn]: Failed to resolve component: van-button" #18

zhoufenfens opened this issue Jan 6, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@zhoufenfens
Copy link

hi, i found a problem in the Console when deploy the build assets to the web server, the van component could not reconized by the vue.

https://stackblitz.com/edit/vitejs-vite-wbqtdm?file=README.md

the development env was okay, but it is not okay when run "npm run build" and deploy the dist directory to the web server.

sorry i could not found any online web server could serve the dist dir.

@zhoufenfens
Copy link
Author

hi, here is my sample
https://stackblitz.com/edit/vitejs-vite-wbqtdm?file=vite.config.js

run the script "npm run build";
then run the "npm run preview";
the button in news.vue looks like a text;
image

then comment the manualChunksPlugin(),
image

rerun "npm run build & npm run preview"
the button in news.vue works well
image

@zhoufenfens zhoufenfens reopened this Jan 7, 2023
@zhoufenfens
Copy link
Author

zhoufenfens commented Jan 7, 2023

then, I created a news2 component, add removed the comment "/* webpackChunkname: news2 */"
image
this worked well for the News2 even though add the manualChunksPlugin()
image

@CaptainLiao CaptainLiao added the bug Something isn't working label Jan 9, 2023
@CaptainLiao
Copy link
Owner

CaptainLiao commented Jan 12, 2023

@zhoufenfens

Please add include: [/\.vue$/, /\.vue\?/] in vite.config.js:

import Components from 'unplugin-vue-components/vite';
...
  plugins: [
    Components({
      resolvers: [VantResolver()],
      include: [/\.vue$/, /\.vue\?/]
    }),
  ],
...

@zhoufenfens
Copy link
Author

thanks, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants