1.npm安装
npm install babel-polyfill
npm install es6-promise
package.json中会出现
"babel-polyfill": "^6.26.0",
"es6-promise": "^4.1.1",
2.main.js引入
import Vue from 'vue'
import Es6Promise from 'es6-promise'
require('es6-promise').polyfill()
Es6Promise.polyfill()
3.webpack.base.conf.js
module.exports = {
entry: {
"babel-polyfill":"babel-polyfill",
app: './src/main.js'
},
配置后把控制台关了后再npm run dev!
改完后还有问题,试试编译后,在测试服环境下运行,记得清缓存!!
想哭了,一直报这个错,然后不知道是引入了哪个插件导致的,结果import '../mock/index';注释就行了!
报错
网友评论