-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
bug: Ionic standalone components are not treeshakable #28483
Comments
Thanks for following up here. I can reproduce the reported behavior with Webpack, but Ionic is working correctly here. I used https://www.npmjs.com/package/source-map-explorer to determine which components are being pulled into your build, and all of the components included are being used in your application. I did not identify any components being pulled into your build that were not being used in your application: The Webpack + Ionic Module test you conducted is incomplete because it does not account for the lazy chunks that are pulled into the build, only the initial chunks. If you include the lazy chunks you'll see that the IonicModule bundle size is much larger than the Webpack + Standalone bundle size. I used the blank starter app in the example below, but the same concepts apply to your application: Standalone
Module
In your application, the Ionic does not control how your application is bundled, but I can confirm that the unused Ionic components are being correctly removed from your application build. I am going to close this, but let me know if you have any questions. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out. |
Prerequisites
Ionic Framework Version
v7.x
Current Behavior
Ionic standalone components are not treeshakable.
Expected Behavior
Ionic standalone components are treeshakable.
Steps to Reproduce
esbuild
towebpack
bundler and check the build size againionic-module
and build the project againCode Reproduction URL
https://github.com/hakimio/ionic-treeshaking-test
Ionic Info
Build sizes
Webpack + Ionic Module
esbuild + Ionic Standalone components
Webpack + Ionic Standalone components
The text was updated successfully, but these errors were encountered: