学无先后,达者为师

网站首页 Vue 正文

解决报错You are using the runtime-only build of Vue where the template compiler is not available.

作者:时光回溯 更新时间: 2022-03-01 Vue

如图这种方法添加组件时报标题中的错误
在这里插入图片描述
解决方法:
在vue.config.js文件中配置

const path = require("path");

module.exports = {
  // webpack配置 - 简单配置方式
  configureWebpack: {
    resolve: {
      alias: {
        // 别名
        vue$: "vue/dist/vue.esm.js", //加上这一句
        "@api": path.resolve(__dirname, "./src/api"),
        "@utils": path.resolve(__dirname, "./src/utils")
      }
    }
  },
  chainWebpack: config => {
    // GraphQL Loader
    config.module
      .rule('html')
      .test(/\.html$/)
      .use('html-loader')
      .loader('html-loader')
      .tap(options => {
        return options;
      });
  }
}

原文链接:https://blog.csdn.net/qq_43729779/article/details/108201649

栏目分类
最近更新