-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Unable get rid of web component warning #1414
Comments
Not 100% yet, but I think we have to extend It seems to me that we only use it in the compiler so far, so any custom element declared in a render function (or compiled during build) will resolve in a failure here. |
You can add the blew config into
Other the |
@underfin how can I add the same to Vue CLI? |
You can add this into webpack config.It should work (I'm not test it).
|
Oh so we really only check during compile time? My mistake then. |
@BlackSonic for vue-cli you would have to do something like this: // vue.config.js
module.exports = {
chainWebpack: config => {
// get the existing vue-loader rule and tap into its options
config.module.rule('vue-loader').tap(options => {
option.compilerOptions = {
...(options.compilerOptions || {}), // merge existing compilerOptions, if any
isCustomElement: tag => /^x-/.test(tag)
}
})
}
} |
Look it is for now and this will not generate code for customer component import and don't check it with runtime. |
@LinusBorg I get this message: |
I've tried this config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions = {
...(options.compilerOptions || {}), // merge existing compilerOptions, if any
isCustomElement: tag => /^e-/.test(tag)
}
}); but now it seems that it tries to compile components with
|
As pointed out, Vue 3 requires configuring custom elements via compiler options if pre-compiling templates. This seems to be now a Vue CLI specific configuration problem so I'm closing it. But feel free to continue the discussion. /cc @sodatea |
I've found the fix. The Vue CLI config is: module.exports = {
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => {
options.compilerOptions = {
...(options.compilerOptions || {}),
isCustomElement: tag => /^x-/.test(tag)
};
return options;
});
}
}; And in addition, I needed to install the beta version of vue-loader |
This seems to break now that vue-cli isn't using vue-cli-plugin-vue-next anymore. Module Error (from ./node_modules/vue-loader/lib/index.js):
[vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options. When removing the vue-loader rule the app will compile but the warnings show up again. EDIT: installing the beta version of vue-loader fixed that for me as well |
I'm still getting the error when using custom webpack build Failed to resolve component: xyz Versions:
Webpack:
|
需要安装vue-loader@next和vue-template-compiler能行 |
@vuesomedev worked for me, hoewever I had to get rid off one line, otherwise vue-cli wouldn't compile:
|
Thanks to everyone else who has shared.
I love Vue, but I really wish the Vue folks would unburden the project by making SFC the default and therefore make the build process that much easier. |
Hi, |
@vuesomedev What about solution for Vite.config.js |
For vite this worked for me:
|
@blabbath can you explain how you import your components? Please.
|
webpack4 webpack.config.js. ref. https://v4.webpack.js.org/concepts/loaders/
|
Version
3.0.0-beta.15
Reproduction link
https://github.com/blacksonic/vue-3-playground
Steps to reproduce
app.config.isCustomElement = tag => /^x-/.test(tag);
What is expected?
The application shouldn't log warning as it is configured to treat the element as a webcomponent
What is actually happening?
Vue logs warning:
[Vue warn]: Failed to resolve component: x-username
The component is displayed however
I wanted to find a replacement from Vue 2 ignoredElements
Vue.config.ignoredElements = [/^x-/];
The text was updated successfully, but these errors were encountered: