Wow! I carefully read webpack > v4.16.0 > documentation > Guide > Tree Shaking"s introduction to sideEffects, whether in terms of the meaning on the surface of his document or in context, the attribute sideEffects seems to be used to cut out unintroduced code (that is, the dead code hinted in this article), such as the following:
//index.js node_modules mypluginindex.js package.json
function a(){"is a"};
function b(){"is b"};
export {a , b};
//package.json
{
"name":"myplugin",
"sideEffects":false
}
//main.js
import {a} from "myplugin";
a();
when the output code after packaging no longer contains the code related to the b function, but "sideEffects": false is of no use, or all the code is packaged, but if you want to remove the b code, just mode: "development"! So. What on earth is this sideEffects? What"s the use? What exactly is the scene?
there is also that this thing should be set in the package.json of the module, and the webpack document also says that this is a library-level setting, so is it that this thing can only be set by the author of the module? It is useless for us to set it up, but the reinstallation module will be gone! Wow, confused.