启动webpack-dev-server出现以下错误

ERROR in main.js from UglifyJs
Unexpected token: name «element», expected: punc «;» [main.js:906,8]

解决方法

1.添加.babelrc,添加以下内容

{
"presets": ["@babel/env"]
}
2.webpack.config.js添加以下内容
module: {
  rules: [
    ...
    { test: /\.js$/, use: 'babel-loader' }
  ]
}
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案