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

dev下,esm的包不会自动按需加载 #3625

Closed
July-ing opened this issue Jun 26, 2023 · 12 comments · Fixed by #4747
Closed

dev下,esm的包不会自动按需加载 #3625

July-ing opened this issue Jun 26, 2023 · 12 comments · Fixed by #4747
Assignees
Labels

Comments

@July-ing
Copy link

System Info

System:
OS: macOS 13.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 11.04 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Browsers:
Chrome: 114.0.5735.133
Safari: 16.2
Safari Technology Preview: 14.1

Details

现象:
image

期望像 webapck 一样:
image

demo 中只是用 antd 举例,实际使用中依赖的三方包导出不规范, 如果使用 babel-import-plugin ,需要定义不同的customName

Reproduce link

https://github.com/July-ing/rspack-demo

Reproduce Steps

pnpm dev

@July-ing July-ing added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jun 26, 2023
@hardfist
Copy link
Contributor

webpack默认也不会实现该功能,如果需要的话试试这个 https://www.rspack.dev/config/builtins.html#builtinspluginimport

@hardfist hardfist added question and removed bug Something isn't working labels Jun 26, 2023
@July-ing
Copy link
Author

webpack默认也不会实现该功能,如果需要的话试试这个 https://www.rspack.dev/config/builtins.html#builtinspluginimport

我用cra建的项目默认是支持这个功能的,就是上面第二张图,没有做任何额外的配置。builtins.import 现在无法满足我的诉求,因为需要定义不同的customName

@hardfist
Copy link
Contributor

我没有在cra的文档上找到支持该功能,请提供可复现的cra的demo

@July-ing
Copy link
Author

我没有在cra的文档上找到支持该功能,请提供可复现的cra的demo

https://github.com/July-ing/cra-demo

@hardfist
Copy link
Contributor

hardfist commented Jun 27, 2023

经确认,这个其实是webpack的一个treeshaking优化,当手动配置 antd的package.json的sideEffects:true的时候,导入路径就变成了antd/lib/index.js,后续我们跟进下这个treeshaking优化, cc @IWANABETHATGUY

@IWANABETHATGUY IWANABETHATGUY self-assigned this Jun 28, 2023
@hyf0 hyf0 removed the pending triage The issue/PR is currently untouched. label Jun 29, 2023
@stale
Copy link

stale bot commented Aug 28, 2023

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Aug 28, 2023
@hardfist
Copy link
Contributor

bump

@pushkargupta9807
Copy link

bump
image

@pushkargupta9807
Copy link

just a gentle nudge, @IWANABETHATGUY @hardfist on this bug for an approx ETA .
It is a major blocker for my experiment to transition to rspack and it would help me re-prioritise mu tasks.

Copy link

stale bot commented Nov 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Nov 21, 2023
@hardfist
Copy link
Contributor

bump

@IWANABETHATGUY
Copy link
Contributor

You can try
0.4.0-canary-751d297-20231124070013

with config below:

+experiments {
+   rspackFuture {
+     newTreeshaking: true   
+  }
+}

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

Successfully merging a pull request may close this issue.

5 participants