Babel错误:无效版本:70001900000

hc8w905p  于 2023-05-04  发布在  Babel
关注(0)|答案(1)|浏览(183)

免责声明:我在CHANGELOG中没有找到任何有用的东西。
我最近升级了以下Babel依赖项:

@babel/core          ^7.15.0  ->  7.21.5
@babel/preset-env    ^7.14.7  ->  7.21.5
@babel/preset-react  ^7.14.5  ->  7.18.6

开玩笑也没用了我的测试是TSX文件,我使用预设的ts-jest/presets/js-with-babel-esm

FAIL  spec/javascripts/ActiveDocs/components/FormAlert.spec.tsx
  ● Test suite failed to run

    TypeError: /opt/app-root/src/project/spec/javascripts/__mocks__/global-mocks.js: Invalid Version: 70001900000

      at new SemVer (node_modules/semver/semver.js:314:11)
      at compare (node_modules/semver/semver.js:647:10)
      at Function.lt (node_modules/semver/semver.js:688:10)
      at PluginPass.pre (node_modules/@babel/plugin-transform-named-capturing-groups-regex/node_modules/@babel/helper-create-regexp-features-plugin/lib/index.js:50:44)
          at transformFile.next (<anonymous>)
          at run.next (<anonymous>)
          at transform.next (<anonymous>)
      at evaluateSync (node_modules/gensync/index.js:251:28)
      at sync (node_modules/gensync/index.js:89:14)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:542:31)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:671:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:723:19)

编辑:这不是玩笑的问题,而是巴别塔的问题。运行webpack进行转译时也会发生同样的错误。
以下是包含这些更改的存储库的链接:https://github.com/3scale/porta/pull/3340/files

soat7uwm

soat7uwm1#

结果发现我错过了目标浏览器。当我在我的package.json中设置一个支持的浏览器数组时,错误消失了:

"browserslist": [
  "chrome >= 107",
  "firefox >= 105",
  "edge >= 107"
],

我假设添加一个.browserslistrc或等效的配置文件也可以工作。

相关问题