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

chore: optimize webpack-dev-mock transformer #5162

Merged
merged 2 commits into from
Jan 24, 2022

Conversation

toSayNothing
Copy link
Contributor

use esbuild to transform the code in require hook

resolve #5136


const mod = module.constructor.prototype

@babel/register :
source file => require => hook: babel => mod._compile => code
esbuild:
source file => require => hook: esbuild => mod._compile => code

the require hook is implemented by Pirates https://github.com/danez/pirates/blob/main/src/index.js


本地测试过大概 400 行的 ts 文件:
babel: 500ms
esbuild: 200 ms

@CLAassistant
Copy link

CLAassistant commented Jan 20, 2022

CLA assistant check
All committers have signed the CLA.

@ClarkXia ClarkXia requested review from ClarkXia and luhc228 January 21, 2022 02:18
@ClarkXia ClarkXia changed the base branch from master to release-next January 24, 2022 06:06
Copy link
Collaborator

@ClarkXia ClarkXia left a comment

Choose a reason for hiding this comment

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

LGTM

@ClarkXia ClarkXia merged commit a0ef665 into alibaba:release-next Jan 24, 2022
@ClarkXia ClarkXia mentioned this pull request Jan 24, 2022
9 tasks
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.

优化 mock 服务依赖和编译速度
4 participants