-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Feature Request]: Babel plugin to transform imports to subpackage imports #9651
Comments
Oh apparently this used to exist: #3869 . My organization needs this. We're running Webpack 5 and Babel 7. |
Hi there @brandones! 👋 Teams should not require needing to do sub-package imports as the project is set up for tree-shaking out of the box. Are you / your team currently experience challenges with a large bundle? If so, could you share more details about what is being included? |
Oh, this is interesting. I don't know at what point we decided that carbon-components-react wasn't tree shaking, but it seems not to be true, at least any more. I just did a bundle analysis and found no difference between the normal import and subpackage import. I do have an unrelated question, though. What's going on with "bucket," here? This is a sample project that has And here's a breakdown from a real project we have, which actually does use icons: Maybe there's something wrong with how we're bundling |
@brandones typically when all of the icons are included, there is a CommonJS import somewhere in the code. Here is a comment where we touched on this briefly: #6602 (comment) Hope this helps! |
Yes, it appears that this app has an import from |
Summary
Asking for development of a babel plugin which would transform standard Carbon imports into subpackage imports.
Justification
This would provide the best possible DX, since developers wouldn't have to worry about identifying the right way to do a subpackage import, which presently is not obvious.
This would also solve #9540, since Typescript would work on the main namespace import.
Desired UX and success metrics
No response
Required functionality
The plugin should transform standard imports like
into subpackage imports like
or
Where a configuration option specifies whether to use
lib
ores
(or any other option).Specific timeline issues / requests
No response
Available extra resources
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: