1

我尝试基于 Webex Web SDK 构建一个小型应用程序,内部需要 regenerator-transform。

这是我的package.json简单文件:

{
  "scripts": {
    "serve": "yarn build",
    "build": "parcel index.html --out-dir dist --public-url ./",
    "deploy": "git subtree push --prefix dist origin gh-pages",
  },
  "license": "MIT",
  "dependencies": {
    "crypto-js": "^4.0.0",
    "moment": "^2.24.0",
    "urijs": "^1.19.2",
    "webex": "^1.80.147"
  },
  "browserslist": [
    "last 2 major versions and >1%"
  ],
  "devDependencies": {
    "@babel/core": "^7.8.7",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-es2016": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1"
  }
}

这也是我的.babelrc文件:

{
    presets : [ 'es2015', 'es2016' ]
}

browserslist当我使用preset时它工作得很好latest Chrome,但是对于这个当前查询,我有这个错误:

[...]pkijs/src/SignedCertificateTimestampList.js: unknown Statement of type "ForOfStatement"

完整的堆栈跟踪:

  /Users/guillaumepotier/Sites/webex-sdk/node_modules/pkijs/src/SignedCertificateTimestampList.js: /Users/guillaumepotier/Sites/webex-sdk/node_modules/pkijs/src/SignedCertificateTimestampList.js: unknown Statement of type "ForOfStatement"
    at Emitter.Ep.explodeStatement (/Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/emit.js:587:13)
    at /Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/emit.js:323:12
    at Array.forEach (<anonymous>)
    at Emitter.Ep.explodeStatement (/Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/emit.js:322:22)
    at Emitter.Ep.explode (/Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/emit.js:280:40)
    at PluginPass.<anonymous> (/Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/visit.js:111:17)
    at PluginPass.<anonymous> (/Users/guillaumepotier/.config/yarn/global/node_modules/regenerator-transform/lib/util.js:28:17)
    at newFn (/Users/guillaumepotier/.config/yarn/global/node_modules/@babel/traverse/lib/visitors.js:179:21)
    at NodePath._call (/Users/guillaumepotier/.config/yarn/global/node_modules/@babel/traverse/lib/path/context.js:55:20)
    at NodePath.call (/Users/guillaumepotier/.config/yarn/global/node_modules/@babel/traverse/lib/path/context.js:42:17)

似乎问题是由regenerator-transform生成器中的“ForOfStatement”引发的,我尝试了许多 babel 不同的配置,但徒劳无功。

我的parcel --version给我1.12.4

您对此有任何线索,您如何使用 Parcel for IE11 发送代码?

4

0 回答 0