Skip to content
This repository has been archived by the owner on Jan 8, 2018. It is now read-only.

importing capitalize() from ES2015 build of lodash #22

Merged
merged 1 commit into from
Apr 20, 2016
Merged

Conversation

tomwayson
Copy link
Owner

Demonstrate how to include ES2015 code in the bundle. Thanks to tree shaking, only the imported capitalize() function and the functions it calls (and unfortunately any code that Rollup can't determine whether or not it is needed) is brought into the bundle.

The purpose of this is illustrate the tradeoffs involved when bundling vendor code w/ application code. On the one hand, it's included in the single download, and you have direct access to the vendor functions while debugging. On the other hand the bundle is now a bit more cluttered and can be harder to debug.

This works OK, but in this case, b/c we're already concatenating and minifying vendor code into vendor.js, I'm not sure it benefits this application. I'm pretty sure you could get a full custom build of lodash into vendor.js for about the same size (or less since I'm not doing a great job w/ source maps) and number of requests as result from this PR.

There are plenty of opportunities to tweak build configurations (maybe a dev build focused on debugging, or better use of sourcemaps), so I think it's worth merging this experiment as is even though in a real app I'll probably just include (a custom build of?) lodash in vendor.js.

demonstrate how you can include ES2015 code in the bundle
@tomwayson tomwayson merged commit f6ac4b4 into master Apr 20, 2016
@tomwayson tomwayson deleted the lodash-es branch April 20, 2016 22:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant