bug: side effects with reassignment in ionic 6 + webpack, vite
See original GitHub issuePrerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
I have an Ionic React v5 app that I upgraded to v6. When I did so and inspected the bundle size:
react-scripts build --stats; webpack-bundle-analyzer build/bundle-stats.json
I noticed that the node-modules bundle is now 3x larger (from ~500 kB to 1.4 MB).
Here’s my Ionic 5 app bundle:
And here’s the Ionic 6 bundle:
The only changes between the code for Ionic v5 and v6 are a few lines to update a datetime component, so these builds are basically identical except for the Ionic version.
Expected Behavior
When upgrading to the next major Ionic version, the bundle size should be roughly the same or smaller than the previous version.
I read in the beta announcement that even smaller bundles are coming to Vue first, and then React and Angular, but I didn’t except a massive size increase.
Steps to Reproduce
Update a moderately sized app from v5 to v6.
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.18.0 (/home/me/.local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 6.0.0-rc.3
Capacitor:
Capacitor CLI : 3.3.2
@capacitor/android : 3.3.2
@capacitor/core : 3.3.2
@capacitor/ios : 3.3.2
Utility:
cordova-res : 0.15.3
native-run : 1.5.0
System:
NodeJS : v14.16.0 (/usr/local/bin/node)
npm : 7.19.1
OS : Linux 4.19
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (8 by maintainers)
Top GitHub Comments
Relevant change is in Vite 2.7.0-beta.5.
Specifically, these changes in
packages/vite/src/node/plugins/resolve.ts
:Removing that
reverse()
(see second diff) fixes it… Causes these changes:Following up on this: This issue is happening due to a bug in Webpack. I have reported the issue here: https://github.com/webpack/webpack/issues/14963
We are investigating potential workarounds and will follow up here when we have more to share.
edit Jan 27 2022: This also impacts Vite. See https://github.com/ionic-team/ionic-framework/issues/24655. We have an experimental fix that seems to resolve this issue. I will update this thread when I have more to share.