I'm wondering if one thing, for example, if we use a package, let's named X, and inside of it there are 3 methods :
void method1() {}
void method2() {}
void method3() {}
and in my whole project, I used just the method2()
of them, when building the release app, does the whole package will be included inside the release app, or just the used methods and the unused ones are removed?
or the question is, should I care about extracting or researching the minimal useful package for me, or I am good with using any large package ?
CodePudding user response:
As much as I know, unnecessary parts will be removed by tree-shaking.
Based on build-modes#release
The build is minified and tree shaking has been performed.
The tree shaking method remove the dead code.
So while you only use method2()
, others unused methods will be removed.