webpack打包 vuex...mapMutations ,...mapGetters报错解决

xiaoxiao2021-02-28  103

在开发vue项目中使用vuex 的 …mapMutations等语法时webpack打包发生错误 Unexpected token,解决办法: 先安装: cnpm install –save-dev babel-plugin-transform-object-rest-spread 安装成功后: 在项目根目录新建.babelrc,(如果存在,修改内容) 放入下面内容: { “presets”: [ [“es2015”, { “modules”: false }] ], “plugins”: [“transform-object-rest-spread”] } 参考http://www.tuicool.com/articles/ea2QF3z

转载请注明原文地址: https://www.6miu.com/read-30460.html

最新回复(0)