DEV Community

Discussion on: How To Setup Rollup Config

Collapse
 
antialias profile image
Thomas Hallock

lodash exports as CommonJS (via UMD), so there's no need to configure rollup to grab it off window... unless you're demonstrating how this can be done, and if that's the case, it might be helpful to point out that's why you did what you did and that normally (i.e. most modern packages) you'd just npm / yarn install your package and not have to muck with your bundler config at all.

Also, no need to install all of lodash and blow up your bundle size with all its functions if you're just going to use a couple of functions from it; e.g. lodash.concat and all the other lodash functions are published individually.

But then again, why use _.concat at all when your browser can already concat arrays pretty well without a library?