vuecli3 引入构建版本的2种方式

对需要使用compile或者在vue构造函数中使用template 选项时,需要引入构建版本(完整版)的vue.js。

需要在vue.config.js中进行配置,有如下2种方法:

const path = require('path');
function resolve (dir) {
    return path.join(__dirname, dir)
}
module.exports = {
  // 方法1
  // runtimeCompiler:true,
  chainWebpack: config => {
    config.resolve.alias
    // 方法2
      .set('vue$','vue/dist/vue.esm.js')// vue完整版
 } }

猜你喜欢

转载自www.cnblogs.com/mengfangui/p/12638054.html