0.1 2018.12.29 16:13* 字数 227 阅读 927评论 0喜欢 1
babel-loader和babel-core版本不对应所产生的,
1、 卸载旧的babel-core
npm un babel-core
2、 安装新的babel-core
npm i -D @babel/core
3、 卸载旧的babel-preset
npm un babel-preset-env
npm un babel-preset-stage-0
4、 安装新的babel-preset
npm i @babel/preset-react
npm i @babel/preset-env
npm i babel-preset-mobx
5、 卸载旧的babel-plugin
npm un babel-plugin-transform-runtime
6、 安装新的babel-plugin
npm install --save-dev @babel/plugin-proposal-object-rest-spread
npm install --save-dev @babel/plugin-transform-runtime
npm install --save @babel/runtime
7、 修改.babelrc文件
{
"presets": ["@babel/preset-env", "@babel/preset-react", "mobx"],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime"
]
}
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4",
"babel-preset-mobx": "^2.0.0",
"css-loader": "^2.1.0",
"file-loader": "^3.0.1",
"popper.js": "^1.14.6",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"webpack": "^4.28.2",
"webpack-cli": "^3.1.2"
},
"dependencies": {
"@babel/runtime": "^7.2.0",
"bootstrap": "^4.2.1",
"jquery": "^3.3.1"
}