plasmo
plasmo copied to clipboard
[RFC] Whether can we reduce bundle size by extract common code?
How do you envision this feature/change to look/work like?
Hi,I have a question about plasmo build. I want to know if there is any way to solve it now.
When there are two .tsx in content and a .tsx in tabs,plasmo will generate three js files after build like content.xxx.js、sidecard.xxx.js、full-chat.xxx.js.
Because the three tsx will be built separately,so if they import many common components、utils、mobx store,it will cause every js bundle contain repeated content and the package zip will be large.
So whether can we extract the common code to a content.js which can be include by other js or html?
For Example, we can combine all js code in one file named content.js,the full-chat.html in tabs or option.html in options can include content.js directly,so there will be only content.js in package zip.
What is the purpose of this change/feature? Why?
avoid repeated code in different js bundle to reduce package zip size
(OPTIONAL) Example implementations
For Example, we can combine all code in one file named content.js,the full-chat.html in tabs can include content.js directly,so there will be only content.js in package zip.
(OPTIONAL) Contribution
- [ ] I would like to contribute to this RFC via a PR
Verify canary release
- [X] I verified that the issue exists in
plasmo
canary release
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate problems.