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

Add export * from 'base.js' for better modularity #400

Closed
wants to merge 1 commit into from

Conversation

LeeSamFong
Copy link

I hope to add this codes to support friendlier tree-shaking

@sindresorhus
Copy link
Owner

Tree-shaking should work fine even without this. If not, the problem is the bundler you use.

@LeeSamFong
Copy link
Author

LeeSamFong commented Dec 5, 2024

Thank you, sindresorhus, for your reply.

For this, I have provided 2 demos.

Before add export * from "./base.js"

When I try to import the following code, the output generated by Rollup will be over 600 lines of code.
QQ_1733417060906

input: https://github.com/LeeSamFong/query-string/blob/before/test.js
output: https://github.com/LeeSamFong/query-string/blob/before/dist/bundle.js


When I import them separately, the build output will only be around 200 lines of code.
QQ_1733417181667

input: https://github.com/LeeSamFong/query-string/blob/after/test.js
output: https://github.com/LeeSamFong/query-string/blob/after/dist/bundle.js

@LeeSamFong
Copy link
Author

If I have any misunderstandings, can sindresorhus point them out for me?

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.

2 participants