import-size
import-size copied to clipboard
Include 0-import cost
It would be great if it could also always report 0-import cost. What I mean is basically always also trying entry with this: https://github.com/mweststrate/import-size/blob/8fc7d170584d07130376ed679583e303ec12da31/index.js#L12
It would serve as a good basic test for treeshakeability as a whole. To get reliable tests for this we'd have to remove sideEffects: false
from the imported module - or force webpack to ignore it. Otherwise, it most likely would always report 0, even for non-treeshakeable modules.
I tried that, but it is basically interpreted as a side-effect full import, always yielding the same result as * as
from what I tried, so didn't seen to add any value.
I've done preliminary investigation and it seems that's the fault of used import-size
package. It "transforms" import "${library}";
input to import * as tmp from "${library}";console.log(tmp);
. Making it effectively the same as import * as "${library}";
input.
This happens here: https://github.com/wix/import-cost/blob/a8b24cce7ef4bc7836d28a2913d3788eabc56cda/packages/import-cost/src/babelParser.js#L112
So to make what I've requested to work we should reach out to them to see if they would like to support calculating costs for bare imports, probably behind a flag or something.
Sounds like an actual bug that would be worth fixing, rather than needing an additional flag :). This package is used to report import sizes in VSCode, so that is probably incorrect there as well.
On Tue, Feb 18, 2020 at 10:05 PM Mateusz Burzyński [email protected] wrote:
I've done preliminary investigation and it seems that's the fault of used import-size package. It "transforms" import "${library}"; input to import
- as tmp from "${library}";console.log(tmp);. Making it effectively the same as import * as "${library}"; input.
This happens here:
https://github.com/wix/import-cost/blob/a8b24cce7ef4bc7836d28a2913d3788eabc56cda/packages/import-cost/src/babelParser.js#L112
So to make what I've requested to work we should reach out to them to see if they would like to support calculating costs for bare imports, probably behind a flag or something.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mweststrate/import-size/issues/3?email_source=notifications&email_token=AAN4NBH5HD6S4VRJ6X7PREDRDRLTVA5CNFSM4KWBNDEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMFQZWY#issuecomment-587926747, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBGLXOZNYEAOSBVPLMLRDRLTVANCNFSM4KWBNDEA .