解决问题:[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not.....

问题描述

//解决问题:[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.(found in <Root>)

解决方法

webpack.base.conf.js 中添加:

resolve: {
    extensions: ['.js', '.vue', '.json',".css"],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
    }
  },

vue.config.js 中添加:

module.exports = {
  runtimeCompiler: true,
  configureWebpack: config => {
    config.resolve = {
      extensions: ['.js', '.vue', '.json', ".css"],
      alias: {
        'vue$': 'vue/dist/vue.esm.js',
      }
    }
  }
}

版权声明:本文为liu798675179原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。