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

feat: support use swc with mfsu #10198

Merged
merged 9 commits into from
Jan 5, 2023
Merged

Conversation

fz6m
Copy link
Contributor

@fz6m fz6m commented Jan 3, 2023

这个 PR 做了几件事

  1. swc 可以与 mfsu 一起使用了:跳过 swc 对 MFSU 使用了 top level await 的 virtual entry 文件处理,因为 swc 不支持 top level await ,在开发时跳过他们没有影响,浏览器是支持的。

  2. 使用 rust 插件解 swc 不可用的问题:因为 swc 不再维护 js 插件(目前 1.3.x 的 swc 与 umijs 也是无法一起使用的,js 插件无效),所以解法是使用 rust 写的 auto css modules 插件代替,插件已经移动到了 umijs 组织下( https://github.com/umijs/swc-plugin-auto-css-modules ),考虑到体积,swc 的依赖安装都是按需的。

  3. 升级 swc 版本,因为插件需要 1.3.x 新的 swc 版本。

  4. 支持用户配置 swc 和 esbuild 转译器选项:考虑到 swc 已有众多生态插件,如支持 css in js ,所以需要配置的入口。

@vercel
Copy link

vercel bot commented Jan 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
umi ⬜️ Ignored (Inspect) Jan 4, 2023 at 3:31AM (UTC)

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

Base: 29.56% // Head: 29.55% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (0f084e7) compared to base (7afa433).
Patch coverage: 37.28% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10198      +/-   ##
==========================================
- Coverage   29.56%   29.55%   -0.01%     
==========================================
  Files         433      433              
  Lines       12483    12521      +38     
  Branches     3006     3022      +16     
==========================================
+ Hits         3690     3701      +11     
- Misses       8217     8243      +26     
- Partials      576      577       +1     
Impacted Files Coverage Δ
packages/bundler-webpack/src/dev.ts 0.00% <0.00%> (ø)
packages/bundler-webpack/src/schema.ts 72.22% <0.00%> (-1.37%) ⬇️
...s/bundler-webpack/src/swcPlugins/autoCSSModules.ts 83.33% <ø> (-5.56%) ⬇️
...eset-umi/src/features/depsOnDemand/depsOnDemand.ts 0.00% <0.00%> (ø)
packages/bundler-webpack/src/loader/swc.ts 70.58% <64.00%> (-9.42%) ⬇️
...ages/bundler-webpack/src/config/javaScriptRules.ts 74.28% <75.00%> (-1.43%) ⬇️
packages/bundler-webpack/src/types.ts 100.00% <100.00%> (ø)
packages/mfsu/src/constants.ts 100.00% <100.00%> (ø)
packages/mfsu/src/mfsu/mfsu.ts 53.48% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stormslowly
Copy link
Member

我之前也通过 改 transpiler 的方式做过 benchmark ,性能提升没有用现在的 esbuild 直接构建方案的明显(我猜 主要还是 webpack 单个文件 load 拖慢了整体的速度)

@sorrycc
Copy link
Member

sorrycc commented Jan 5, 2023

👍🏻👍🏻

@sorrycc sorrycc merged commit ab28b95 into umijs:master Jan 5, 2023
@qiutian00
Copy link

umi3可以支持么?

@stormslowly
Copy link
Member

umi3可以支持么?

还是 推荐升级到 Umi 4 吧

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

Successfully merging this pull request may close these issues.

4 participants