vue 运行脚手架报错

报错:

  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. 

 

解决:

  webpack.config.js 添加如下配置

    resolve: {

      alias: {

        vue: 'vue/dist/vue.js'

      }

    }

  或者

    import vue from 'vue/dist/vue.js';

 

原因:

  vue默认配置的是runtime版本。

 https://cn.vuejs.org/v2/guide/installation.html#%E8%BF%90%E8%A1%8C%E6%97%B6-%E7%BC%96%E8%AF%91%E5%99%A8-vs-%E5%8F%AA%E5%8C%85%E5%90%AB%E8%BF%90%E8%A1%8C%E6%97%B6




猜你喜欢

转载自www.cnblogs.com/echolife/p/9139997.html