标签:code base 文件 pac lse 引入 install tran node
在引入element-ui引发的问题,解决如下:
1.npm install babel-preset-es2015 --save-dev
2.修改.babelrc
{ "presets": [ ["es2015", { "modules": false }], ["env", { "modules": false, "targets": { "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] } }], "stage-2" ], "plugins": [ "transform-vue-jsx", "transform-runtime", [ "component", { "libraryName": "element-ui", "styleLibraryName": "theme-chalk" } ] ], "env": { "test": { "presets": ["env", "stage-2"] } } }
3.在webpack.base.conf.js文件中加入如下代码:
loaders: [ { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: ‘babel‘, query: { presets: [‘es2015‘] } } ]
Couldn't find preset "es2015" relative to directory
标签:code base 文件 pac lse 引入 install tran node
原文地址:https://www.cnblogs.com/lude1994/p/12004642.html