What on earth is webpack4 sideEffects?

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.


personal humble opinion: "sideEffects": false just tells webpack that he has found the unused b code and really wants to delete it in bundle. In fact, he needs to use "UglifyJSPlugin". Using mode: "production" can "activate" UglifyJSPlugin. His next section ides/tree-shaking/-sharpminify-the-output" rel=" nofollow noreferrer "minify the output has a lecture

.
if you want to get rid of the b code, all you have to do is mode: "development".
I don't know what this is.

sideEffects means that there is no code in the module that executes immediately, which usually has side effects. For example:

// a.js 

// ,  import a 
document.body.appendChild(document.createElement('div')); 

// 
export default function foo() {};

through the sideEffects tag, you can tell webpack to use a more simple and efficient way to achieve code tailoring.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e469ec-44bc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e469ec-44bc4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?