compilerOptions.isCustomElement 配置之后不生效

3,109 阅读1分钟

背景

compilerOptions.isCustomElement 配置之后,启动服务还是warning报错 第一次的配置如下,根据官方文档配置的

app.config.compilerOptions.isCustomElement = (tag) => {
     const arr = ['field','block','category','xml','mutation','value','sep'];
     return arr.includes(tag);
}

解决方案

vite

vite.config.js

plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: tag => ['shadow','field','block','category','xml','mutation','value','sep'].includes(tag)
        }
      }
    }),
  ],