Vue 3.0 Warn: Failed to resolve component: xxxx

peterCZG 19 0

vue3.0项目webpack/vite配置不解析的自定义元素标签

1. vite

export default defineConfig({
  plugins: [vue({
    template:{
      compilerOptions:{
        isCustomElement: tag => tag.startsWith('ion-')
      }
    }
  })],
})

2. webpack

module.exports = function(){
    chainWebpack: (config) => {
    config.module
      .rule("vue")
      .use("vue-loader")
      .tap((options) => {
        options.compilerOptions = {
          ...options.compilerOptions,
          isCustomElement: (tag) => tag.startsWith("ion-"),
        };
      });
  }

发表评论 取消回复
OwO 图片 链接 代码

分享