-
Notifications
You must be signed in to change notification settings - Fork 78
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
[treeshaking]: fix treeshaking and add esm and umd versions #1045
Conversation
Deploy preview for carbon-addons-iot-react ready! Built with commit 64f8d53 https://deploy-preview-1045--carbon-addons-iot-react.netlify.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple small things here.
Additionally, the builds are being generated in a src
folder. Is there any way to remove that unecessary second level of nesting so we publish just lib/index.js
, es/index.js
, es/components/ComponentName/ComponentName.js
, etc?
I believe this is the case because of the preserve modules flag. We can only dictate a directory with this property set to true but luckily we tell consuming apps where to find the entry point and all paths like ones used for styles are still valid. |
…eact into tree-shake-build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
🎉 This PR is included in version 2.61.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #993 closes #1011
Summary
Changes to our build to allow for es and umd versions and to allow for treeshaking in consuming applications.
Change List (commits, features, bugs, etc)
Acceptance Test (how to verify the PR)
yarn build should output a lib, es, umd, and scss folder.
Using the
create-iot-react-app
cli I was able to test the baseline build. Like the issue opened on this reports the original build was around2.74 MB
. With tree shaking and dead code elimination this new build is now able to deliver the same app in under314 KB
which is around an 88.5% savings.