Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 更新捆绑的@babel/* #9664

Closed
liuxingbaoyu opened this issue Oct 31, 2022 · 2 comments
Closed

[Bug] 更新捆绑的@babel/* #9664

liuxingbaoyu opened this issue Oct 31, 2022 · 2 comments

Comments

@liuxingbaoyu
Copy link

liuxingbaoyu commented Oct 31, 2022

What happens?

babel 在 v7.20.0 中添加了对TSSatisfiesExpression的支持
似乎 umi 捆绑了 babel,这导致部分依赖新版本@babel/types的 babel 插件无法正常工作
babel/babel#15089 (comment)

比较简单快速的方法是更新捆绑的 babel
而如果要为了以后的兼容,可以考虑不捆绑@babel/types,因为所有插件都可能会依赖新版本的@babel/types

Mini Showcase Repository(REQUIRED)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库

antvis/L7#1451
说实话这个重现不怎么小... 但是我不了解 umi 和 L7,也没法提供更好的例子了

How To Reproduce

Steps to reproduce the behavior: 1. 2.

  1. git clone https://github.com/antvis/L7
  2. 撤销 fix: 修复 babel 升级导致的打包报错问题 antvis/L7#1451
  3. yarn
  4. yarn build

失败

lerna ERR! yarn run build stderr:
error - ./src/index.ts
error - Error: ERROR in ./src/index.ts
Module build failed (from ../../node_modules/father/node_modules/@umijs/bundler-webpack/compiled/babel-loader/index.js):
Error: [BABEL] /home/liuxingbaoyu/L7/packages/three/src/index.ts: You gave us a visitor for the node type TSSatisfiesExpression but it's not a valid type
    at verify (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:110950:13)
    at Function.explode (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:110872:3)
    at /home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:30928:42
    at Generator.next (<anonymous>)
    at Function.<anonymous> (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:32690:3)
    at Generator.next (<anonymous>)
    at step (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:9559:32)
    at evaluateAsync (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:9589:5)
    at Function.errback (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:9411:7)
    at errback (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/babel/index.js:32745:18)

webpack compiled with 1 error
    at /home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/dist/build.js:81:18
    at finalCallback (/home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:61758:32)
    at /home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:61775:13
    at Hook.eval [as callAsync] (eval at create (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7744), <anonymous>:33:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:4913)
    at onCompiled (/home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:61773:21)
    at /home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62513:17
    at Hook.eval [as callAsync] (eval at create (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7744), <anonymous>:15:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/liuxingbaoyu/L7/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:4913)
    at /home/liuxingbaoyu/L7/node_modules/father/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62509:33
error Command failed with exit code 1.

Expected behavior 1. 2.

  1. git clone https://github.com/antvis/L7
  2. yarn
  3. yarn build

成功

Context

  • Umi Version:
  • Node Version:
  • Platform:
@onlyling
Copy link
Contributor

onlyling commented Nov 1, 2022

3.5.35 也有相似的问题。

$ dumi dev
[BABEL] /Users/xxx/.umirc.ts: You gave us a visitor for the node type TSSatisfiesExpression but it's not a valid type
Error: [BABEL] /Users/xxx/.umirc.ts: You gave us a visitor for the node type TSSatisfiesExpression but it's not a valid type
    at verify (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:66669:13)
    at Function.explode (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:66591:3)
    at /Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:3207:42
    at Generator.next (<anonymous>)
    at Function.<anonymous> (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:4961:3)
    at Generator.next (<anonymous>)
    at evaluateSync (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:126918:28)
    at Function.sync (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:126756:14)
    at sync (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:5004:25)
    at sync (/Users/xxx/node_modules/@umijs/deps/compiled/babel/bundle.js:126849:19)

==更新==
固定 @babel/plugin-transform-typescript 版本已经正常启动服务。

{
  "resolutions": {
    "@babel/plugin-transform-typescript": "7.19.3"
  }
}

参考:https://stackoverflow.com/a/74236587

@liuxingbaoyu
Copy link
Author

babel/babel#15121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants