1

vue,webpick打包时报错Unexpected token: punc(()
网上说是es2015转换问题,
我的项目没有webpack.config.js文件,
修改

     {
            test: /\.js$/,
            loader: 'babel-loader',
            include: [resolve('src'), resolve('test'),resolve('/src/api/index.js')]
        }
        

也没有效果.求大神指点!!!

六鼎 17
2017-10-30 提问

1 个回答

1

已采纳

下载新的vue-cli,webpack项目,拷贝.babelrc文件到原项目根目录下
{
"presets": [

["env", {
  "modules": false,
  "targets": {
    "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
  }
}],
"stage-2"

],
"plugins": ["transform-runtime"],
"env": {

"test": {
  "presets": ["env", "stage-2"],
  "plugins": ["istanbul"]
}

}
}

推广链接