共计 667 个字符,预计需要花费 2 分钟才能阅读完成。
package.js
中对于 babel 的包如下:
“babel-core”: “^6.0.0”,
“babel-loader”: “^6.0.0”,
“babel-plugin-transform-object-rest-spread”: “^6.26.0”,
“babel-plugin-transform-runtime”: “^6.0.0”,
“babel-plugin-transform-vue-jsx”: “^3.5.0”,
“babel-preset-es2015”: “^6.0.0”,
“babel-preset-stage-3”: “^6.24.1”,
“babel-register”: “^6.0.0”,
“babel-runtime”: “^6.23.0”,
“webpack”: “^3.6.0”,
Vue2.x 中的 mutation.js 文件编译出错
解决方案:
1. 确保不要用 babel.config.js 而是应用.babelrc
2.wepback.base.conf.js 中 js 相干配置如下:
{
test: /.js$/,
loader: “babel-loader”,
include: [resolve(“src”), resolve(“test”), resolve(“node_modules/webpack-dev-server/client”)]
},
- .babelrc 文件内容如下:
{
“presets”: [
["stage-3"
]
],
“plugins”: [
"transform-runtime"
]
}
4. 留神,肯定不要将 es2015 加到 presets 中 ~~ ~~
正文完