I know for a fact that unused Java/.NET imports won't affect performance.
But I also know that implementations of require() (used to?) simply pull and concatenate the entire required module/file at compile time, and that the import statement is sort of an evolution of that. Is it actually different? Will forgetting a very big unused ES6 module in the import list affect my app's performance?
Yes, it will definitely affect performance, especially if you have non-exported code that does something non-trivial in the module or the module imports other modules. The first time you import a module it will be executed once (and only once). According to the spec:
http://www.ecma-international.org/ecma-262/6.0/#sec-abstract-module-records
Do nothing if this module has already been evaluated. Otherwise, transitively evaluate all module dependences of this module and then evaluate this module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With