4 ms·
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
by drhayes9 11y ago
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-requires https://github.com/substack/node-browserify#external-require...
- haberman 11y agoThe 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.
- drhayes9 11y agoWhoops! That's what I get for speed-linking. I meant this one: https://github.com/substack/node-browserify#bexternalfile 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.