amcharts3 和 ammap3 括号模式错误

amcharts3 and ammap3 Parenthesized pattern error

我在我的 webpack 项目中使用了 npm install 两个模块: 1、npm安装amcharts/amcharts3 2、npm安装amcharts/ammap3

但是当我 运行 'npm start' 时出现以下错误,有人知道如何解决吗?提前致谢。

ERROR in ./~/amcharts3/amcharts/serial.js Module parse failed: /Users/xx/Documents/xx/node_modules/amcharts3/amcharts/serial.js Parenthesized pattern (54:249) You may need an appropriate loader to handle this file type. @ multi (webpack)-dev-server/client?http://localhost:3000 ./src/main.browser.ts

ERROR in ./~/ammap3/ammap/ammap.js Module parse failed: /Users/xx/node_modules/ammap3/ammap/ammap.js Parenthesized pattern (173:426) You may need an appropriate loader to handle this file type.

编辑 2:他们似乎已经在 acorn 中发布了一个修补程序。如果您升级到 4.0.8,它将是 fixed

npm install --save acorn@4.0.8

编辑:这似乎是 Webpack 依赖性的问题 acornacorn 版本 4.0.7 似乎破坏了很多软件包 (related)。临时解决方法是将 acorn 依赖项锁定到较低版本:

// If webpack is a devDependency
$ npm install --save-dev acorn@4.0.4

// If webpack is a production dependency
$ npm install --save acorn@4.0.4

如果您使用的是 npm-shrinkwrap.json 文件,您可能希望将其更改为如下内容:

"acorn": {
  "version": "4.0.4",
  "from": "acorn@>=4.0.4 <5.0.0",
  "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.4.tgz"
},