标题webpack、Babel 使用中报的错误总结
vue-cli的配置
Babel 中运行cnpm run dev报的错
以下是报错信息
Using removed Babel 5 option: foreign.modules -
Use the corresponding module transform plugin in the `plugins` option
解决方法是添加.babelrc文件,内容填写
{
"presets": [
[
"es2015", {"modules": false, "loose": true}
],
["stage-2"]
],
"plugins": [
["transform-runtime"]
],
"comments": false
}
还出现了一个Module build failed: Error: No PostCSS Config found in
在项目根目录下添加配置文件postcss.config.js,内容如下
module.exports = {
plugins: {
'autoprefixer': {browsers: 'last 5 version'}
}
}
在webpack中报错 ,当前没有加载webpack,在项目下重新下一下
cnpm install webpack
项目没有装webpack-dev -server 或版本过高
cnpm install webpack-dev -server@2.11.5