News for hackers. Stuff that matters.
Re:The Controversial State of JavaScript Tooling by haberman on Tuesday February 02, 2016 @02:11PM (#11021657)
How can you use a CDN if you're also using a bundler/minifier?

Put another way, how can you bundle your app such that CDN-available libs are "dynamically linked" but your app and less common libs are "statically linked"?

Re:The Controversial State of JavaScript Tooling by drhayes9 on Tuesday February 02, 2016 @02:12PM (#11021671)
You make the thing you're requiring an "external", such that the bundler knows it's available somewhere but won't include it.

Here's browserify's documentation about the matter: https://github.com/substack/node-browserify#external-require...

Re:The Controversial State of JavaScript Tooling by haberman on Tuesday February 02, 2016 @02:21PM (#11021745)
The doc you linked to describes how to create a bundle of JS that will export a "require()" function exposing the bundled libs to other JavaScript.

That doesn't seem related to the question of how to create a bundle that assumes that some libs have already been loaded with a previous script tag that pulled, say, jQuery from a CDN.

Re:The Controversial State of JavaScript Tooling by drhayes9 on Tuesday February 02, 2016 @03:20PM (#11022197)
Whoops! That's what I get for speed-linking.

I meant this one: https://github.com/substack/node-browserify#bexternalfile

For something like jQuery you might also need a browserify shim. And now we're edging closer into some of the stuff this essay decries.

Re:The Controversial State of JavaScript Tooling by arohner on Tuesday February 02, 2016 @04:45PM (#11022920)
You can always upload the .js files to your own CDN.

The other magic of CDNs (aside from the potential cache reuse that everyone is talking about in this thead) is that the user downloads files from a geographically closer server to them than your server. This is typically a huge speed up, and applies even if your JS files are 100% unique.