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


使用vue-cli搭建的項目,啟動報錯

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

 

解決方法

在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;
      });
  }
}

再次啟動就OK了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM