Reputation: 1183
I used webpack 4 for my app. Somehow, bn.js
package takes up a lot in production build.
The image shows that it takes up 594.22
KB of data. Is there any way to have a 1 file of bn.js
for all packages that depends on bn.js
?
Upvotes: 3
Views: 836
Reputation: 865
This likely happens because your dependencies all require different versions of bn.js
. You could try to define one specific version in the resolutions list in your package.json
:
{
// ...
"resolutions": {
"bn.js": "^5.1.1"
}
}
Keep in mind that newer versions might contain breaking changes which some of the dependencies depended on. You could evaluate your package-lock.json
or yarn.lock
to see what versions of bn.js
are required throughout the dependencies and compare that with the changelog
Upvotes: 2