You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
As a follow up of #263 and #245 (comment), we noticed that the main extension bundle is quite large. We need to review bundled dependencies and options, and remove or optimize any of these that are unused by the extension.
To analyze bundle dependencies, we use webpack-bundle-analyzer. You can get the analysis with
$ node node_modules/.bin/webpack --config webpack.prod.js --json > stats.json
$ npx webpack-bundle-analyzer stats.json out/src
Webpack Bundle Analyzer is started at http://127.0.0.1:8888
Use Ctrl+C to close it
The output is
Reducing bundle size by removing unnecessary large packages
Notice how the bundle has large dependencies that are apparently unused. For instance, let's see its larger dependencies
prettier. It was removed in Remove prettier from bundle #270. It's included because there is transitive dependency through @truffle#resolver#abi-to-sol#prettier, here
highlight.js and graphql. Needs investigated why they are being included and eventually removed.
Reducing bundle size by deduping Truffle packages
Another issue might arise from including the same package multiple times within Truffle. If we zoom in into Truffle,
we can see for instance that the package @truffle/codec is being included multiple times. We need to investigate is that is actually the case, and is so, include it just once.
It seems that by removing both yarn.lock and node_modules and then yarn install, Truffle packages get deduped.
But this solution might be risky, since we might break some dependencies compatibility.
Reducing bundle size by removing Source Maps
Source maps generation was also interfering with bundle size. PR #268 removes source maps altogether from production bundle.
The text was updated successfully, but these errors were encountered:
As a follow up of #263 and #245 (comment), we noticed that the main extension bundle is quite large. We need to review bundled dependencies and options, and remove or optimize any of these that are unused by the extension.
To analyze bundle dependencies, we use
webpack-bundle-analyzer
. You can get the analysis with$ node node_modules/.bin/webpack --config webpack.prod.js --json > stats.json $ npx webpack-bundle-analyzer stats.json out/src Webpack Bundle Analyzer is started at http://127.0.0.1:8888 Use Ctrl+C to close it
The output is
Reducing bundle size by removing unnecessary large packages
Notice how the bundle has large dependencies that are apparently unused. For instance, let's see its larger dependencies
prettier
. It was removed in Removeprettier
from bundle #270. It's included because there is transitive dependency through@truffle#resolver#abi-to-sol#prettier
, herehttps://github.com/gnidan/abi-to-sol/blob/e19eba4c35ec1df075fc2d3d44067a01057f9f12/packages/abi-to-sol/src/solidity.ts#L18-L23
Even if it's being
require
d dynamically, webpack is still including it in the final bundle.faker
. It was removed in Update@truffle/debugger
to removefaker
in bundle #264.highlight.js
andgraphql
. Needs investigated why they are being included and eventually removed.Reducing bundle size by deduping Truffle packages
Another issue might arise from including the same package multiple times within Truffle. If we zoom in into Truffle,
we can see for instance that the package
@truffle/codec
is being included multiple times. We need to investigate is that is actually the case, and is so, include it just once.It seems that by removing both
yarn.lock
andnode_modules
and thenyarn install
, Truffle packages get deduped.But this solution might be risky, since we might break some dependencies compatibility.
Reducing bundle size by removing Source Maps
Source maps generation was also interfering with bundle size. PR #268 removes source maps altogether from production bundle.
The text was updated successfully, but these errors were encountered: