Closed ebrehault closed 6 years ago
I think the documentation is wrong. If you replace "--exclude" with "--external" it'll work fine.
I've also tried to reproduce the handbook's excluding example and ran into the same issue, using Browserify v11.0.0. However, using --external
instead of --exclude
, as suggested by @rubennorte doesn't work either.
In both cases, you get the "Cannot find module 'jquery'" error. Any further suggestions?
The following incantation worked for me:
browserify -r jquery > jquery-bundle.js
(no standalone!)
browserify main.js -x jquery > bundle.js
(where -x is shorthand for --external)
I experienced the same issues as @sh1989, and discovered the same fix. Would be nice to get the docs updated, I'll make a PR
See #62 for an alternative fix.
$ browserify -r jquery --standalone jQuery > jquery-bundle.js
As explain here: https://github.com/substack/browserify-handbook#external-bundles I do the following:
index.html:
main.js:
And when I open my page I get Uncaught Error: Cannot find module 'jquery'
Is it a code bug, a doc bug or am I just missing something ?