-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Publish library as ES5/CJS and ES2015/ESM #2309
Comments
Hi @haverchuck @manueliglesias Can we restart the development on this feature? I would like to volunteer to make the required changes. All I would need is help on the review. The builds on my project have seen improvements of ~20% in compiled bundles. |
@aldo-roman Hi, really sorry for the late response. Currently I'm also working on improving the bundle size of amplify so I can review the pr you sent. Thanks for your contribution, really appreciate it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey guys, any movement on this? I'm still having issues with the UI module. Seems to be similar to #2365 & #2460 tsconfig.json
tsconfig.app.json
package.json
|
@aldo-roman We are doing a phased release and have published ESM builds in our unstable release (publishing both ES5/CJS and ES5/ESM builds for maximum backwards compatibility). Please try and let us know if you have any feedback. |
Im going to close this feature request as this is implemented in the latest version of Amplify. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Is your feature request related to a problem?
Currently, AWS Amplify distributes ES5 compiled code bundled as CJS, ES5/CJS for short. This is not optimal for a JS library.
Describe the solution you'd like
AWS Amplify publishes both ES5/CJS and ES2015/ESM. This proposal will bundle the library packages using rollup instead of webpack, given the easy of setup as well as preference of rollup over webpack for libraries. See https://medium.com/webpack/webpack-and-rollup-the-same-but-different-a41ad427058c
The artifacts published will also be tree-shaked, so final artifacts will be smaller than they are today.
Also, this proposal includes the deprecation of default exports. See #1, #2, #3. Change avoids breaking change by exporting both as named and default, but default is marked as deprecated. Tests should rely on named exports.
Notice this proposal does not bundle code as IIFE or UMD. This is because AWS Amplify is not intended to be consumed directly on browser, but through a JS bundler like webpack.
Sample results
Progress:
Describe alternatives you've considered
Keep using current build setup. This forbids the usage of modern bundlers features, like tree-shaking (webpack, parcel, etc). We are already affected by this, see #1831
Additional context
Also fixes #2199, #1336, #2401
The text was updated successfully, but these errors were encountered: