-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimise CLI Webpack configuration (#2175)
SWC was previously configured to output CJS, which means any imports would be transpiled to `require`. This means that any dependencies would also be loaded as CJS, even though an ESM version may be available. By changing SWC to output ES6 code and not transpiling any imports, Webpack loads potentially more ESM code which can be better optimised and tree-shaken. Below are the old and new file sizes of the examples. For some examples, this change reduces the file size by 70%. <details> <summary>Before this change</summary> ``` 272K ./bip32/dist/bundle.js 344K ./bip44/dist/bundle.js 312K ./browserify-plugin/dist/bundle.js 136K ./browserify/dist/bundle.js 104K ./client-status/dist/bundle.js 152K ./cronjobs/dist/bundle.js 156K ./dialogs/dist/bundle.js 4.0K ./errors/dist/bundle.js 108K ./ethereum-provider/dist/bundle.js 1.1M ./ethers-js/dist/bundle.js 200K ./get-entropy/dist/bundle.js 104K ./get-file/dist/bundle.js 152K ./home-page/dist/bundle.js 164K ./images/dist/bundle.js 104K ./json-rpc/dist/bundle.js 152K ./lifecycle-hooks/dist/bundle.js 108K ./localization/dist/bundle.js 156K ./manage-state/dist/bundle.js 4.0K ./name-lookup/dist/bundle.js 104K ./network-access/dist/bundle.js 152K ./notifications/dist/bundle.js 104K ./rollup-plugin/dist/bundle.js 156K ./signature-insights/dist/bundle.js 152K ./transaction-insights/dist/bundle.js 108K ./wasm/dist/bundle.js 104K ./webpack-plugin/dist/bundle.js 4.6M total ``` </details> <details> <summary>After this change</summary> ``` 256K ./bip32/dist/bundle.js 324K ./bip44/dist/bundle.js 312K ./browserify-plugin/dist/bundle.js 136K ./browserify/dist/bundle.js 104K ./client-status/dist/bundle.js 136K ./cronjobs/dist/bundle.js 136K ./dialogs/dist/bundle.js 4.0K ./errors/dist/bundle.js 108K ./ethereum-provider/dist/bundle.js 300K ./ethers-js/dist/bundle.js 176K ./get-entropy/dist/bundle.js 104K ./get-file/dist/bundle.js 36K ./home-page/dist/bundle.js 152K ./images/dist/bundle.js 104K ./json-rpc/dist/bundle.js 36K ./lifecycle-hooks/dist/bundle.js 104K ./localization/dist/bundle.js 104K ./manage-state/dist/bundle.js 4.0K ./name-lookup/dist/bundle.js 104K ./network-access/dist/bundle.js 104K ./notifications/dist/bundle.js 104K ./rollup-plugin/dist/bundle.js 36K ./signature-insights/dist/bundle.js 36K ./transaction-insights/dist/bundle.js 104K ./wasm/dist/bundle.js 104K ./webpack-plugin/dist/bundle.js 3.2M total ``` </details> --------- Co-authored-by: Frederik Bolding <[email protected]>
- Loading branch information
1 parent
1ec9bf5
commit d844be7
Showing
27 changed files
with
98 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.