-
Notifications
You must be signed in to change notification settings - Fork 18
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
all the methods are individually exportable to reducce the package size #8
base: master
Are you sure you want to change the base?
Conversation
My understanding is that the If some of the package versions in the package-lock are no longer available, you should run |
It seems like you've just changed named exports to default ones. I don't know any rationale behind such decision. All the methods exported individually without this changes and you can import them directly just like Also, ignoring lockfiles is absolutely incorrect. They exist for being committed. |
@sHooKDT I do agree with the ignoring lock files, that's never a good thing 😄 But the rationale behind exporting individual functions is to keep package size small, this allows us to use tree-shaking in order to not import functions we're not using. Here's how This a very much needed feature in the project I'm working on, can we please fix this PR and merge it? I can work on it if needed. |
I can create my own PR with a different take on this, to support both ways of exporting. |
#11 |
I agree with @jasongerbes, that the package lock should stay, as @devpato referred to the best practices about it. They keep the build of this package stable and avoid security problems, which Like @sHooKDT, I wonder, what is the rationale behind using the default exports instead of named imports. Is there are multiple exported items, name exports allow tree-shaking (unreachable code elimination). Wildcard exports are usually frowned upon, because unused exported items cannot be easily detected by the module bundler. named exports make easy to prune the originating module off all code, which is not used not only in any exported function, but also in any exported function, which is not imported by any other module. I do not know, if they analyse all source code to find out, what functions from the imported object are actually accessed. That is the case of the "bundled-interface" modules https://news.ycombinator.com/item?id=15765409 Most JavaScript modules in the I'm reluctant to agree with switching the default exports, because it is a breaking change on the interface, as long as I do not see an objective or subjective advantage of it. @danazkari, how do the named exports prevent you from importing just a single function? How do they hinder the performance? Thank you! |
made the methods individually exportable to reduce size