Wk-notes-01-17-bundling-browser-module-treeshake-2
Last updated
Was this helpful?
Last updated
Was this helpful?
A great cdn:
No bundling and shit !!
htm
Separate Bundling builds
Purpose : To support various consumers including modern browser
Question: how does webpack(npm) consume the pkg
Webpack-v4 enables treeshake out of box. If you are using the correct syntax, and the referenced pkg is correctly bundled. it would be treeshaked.
To enable tree-shaking in lodash, you have to import functions using syntax like
import foo from 'lodash/foo'
.import { foo } from 'lodash'
will not tree-shake, nor will, obviously,import _ from 'lodash'
. Support for this syntax was implemented in Lodash v4.
Example: