Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

feat: config polyfill for bowsers support #652

Merged
merged 9 commits into from
Nov 4, 2022
Merged

Conversation

ClarkXia
Copy link
Collaborator

@ClarkXia ClarkXia commented Nov 1, 2022

对于 ...obj 语法,编译工具会直接进行转化,而对于 Set 等语法,需要通过引入 polyfill 进行处理 #95
因此框架内置目前未处理 Polyfill 逻辑,本次修改涉及以下逻辑:

  • 开启 externalHelpers ,basic-project 项目构建大小减小 5KB 左右(视项目大小和 ES 语法的多少会有明显优势)
  • server 端 swc 默认编译成 es2022(当前最高版本),最终 esbuild 会再次进行编译(兼容到 node 12)
  • 支持 polyfill 选项自动引入 core-js 的模块

@vercel
Copy link

vercel bot commented Nov 1, 2022

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

Name Status Preview Updated
ice-v3 ✅ Ready (Inspect) Visit Preview Nov 4, 2022 at 7:19AM (UTC)

luhc228
luhc228 previously approved these changes Nov 4, 2022
@@ -68,6 +68,8 @@ export function createServerCompiler(options: Options) {
const transformPlugins = getCompilerPlugins({
...task.config,
fastRefresh: false,
env: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的默认值是 false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server 端不需要注入 env 相关的 target,esbuild 默认会处理编译到 node 12

@ClarkXia ClarkXia merged commit 3d704c9 into release-next Nov 4, 2022
@ClarkXia ClarkXia deleted the fix/core-js branch November 4, 2022 09:07
@ClarkXia ClarkXia mentioned this pull request Nov 7, 2022
15 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants