When trying to use browserify to require an already browserified module, I am running into an issue where the bundle cannot resolve the module that has already been browserified.
For instance, I have a file called bundle-1.js
that was bundled using the command:
browserify -r ./bundle-1:bundle.one > build/bundle.one.js
Then, I have another file named bundle-2.js
that uses require('bundle.two')
, and is bundled with the command:
browserify -r ./bundle-2:bundle.two -x ./build/bundle.one.js > build/bundle.two.js
However, when attempting to run the last command, I receive an error stating Cannot find module 'bundle.one'
.
How can I expose the modules from bundle-1
for bundle-2
to use with the module name bundle.one
?
I have created a repository for this example which can be found here: https://github.com/kand/browserify-bundling-tests