-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Import Ergonomics #1227
Comments
It's already solved. Search in issues. Webpack 5 will tree-shake it properly. |
What already solved? Tree-shaking is not the issue here. |
Hidden as the comments this was about are now deletedHey, let's keep the conversation civil and on track, because it becomes kinda heated. @gcanti what do you think about adopting a Code of Conduct, such as https://www.contributor-covenant.org? |
@steida: what @SRachamim proposes is indeed a little bit more ergonomic than the current status quo outlined in the comment that you linked too, IMO. Consider that you won't need to choose between |
@steida It's not hard to do what you recommend to me, it's just that I felt that my proposal wasn't clear enough. The issue you linked to just talks about updating the documentation, while the current issue is a proposal to an entire shift in the import philosophy in the next major release. |
The problem with this is tree shakability, yes you wouldn't have to choose between es6 & lib but the advantage of using es6 is rendered useless by the missing deep scope analysis on the webpack < 5 & rollup shakers. The best solution would be to expose modules like: This is possible by exposing each sub-package with it's own package.json referencing the esm module in "modules" like many other libraries do (e.g. I think this should be evaluated for v3 given it is really a pain point having to choose manually (or perform import-path-rewrite like the ecosystem libraries are forced to do) |
I think |
🚀 Feature request
I find it hard to manually and automatically import functions, types and utilities.
Current Behavior
This is how a typical file of mine looks:
Desired Behavior
I'de like to find everything on the index:
Suggested Solution
It could be better to pascal-case all modules on
index.ts
, and to export all types, allfunction
utilities andpipe
.Consider also to export very handy utilities like
sequence
andtraverse
.Who does this impact? Who is this for?
Tree shaking is not always relevant. In those cases I prefer ergonomics: auto-import should work like a charm and import should be grouped so it would be easy to manually import additional utilities.
The text was updated successfully, but these errors were encountered: