Webpack 4+ already comes with optimisation
out of the box.
There is still one unclear thing to me:
Does deduplication happen across dependencies?
example:
/node_modules/foo has a bundled dependency 'foobar'
but also
/node_modules/bar has a bundled dependency 'foobar'
does webpack dedupe the foobar
dependency when I import both into my main bundle?
import foo from 'foo';
import baz from 'baz';
foo(baz('hello world'));
I would say it doesn't, since those packages come already bundled, but I couldn't find any official documentation about it...