Here is the code snippet:
const bar = () => 11111
function foo(obj) {
return bar(obj);
}
foo()
It's obviously that foo
is an impure function which has side effects, so webpack's tree-shaking will not remove it. But after I search for the bundle, I can't find foo
anymore. It has been removed.
For the webpack.config.js
, I just set mode:'production'
. And for the package.json
, I didn't set sideEffects: false
.