Browserify a Browserified module
See original GitHub issueSo I have three modules to use in an app in a browser.
module-b
depends on module-a
.
module-a
depends on Handlebars
and is composed of several individual internal dependencies, relatively required as in the documentation. module-a
’s foo.js requires bar.js, like so:
var Handlebars = require('handlebars');
var bar = require('./bar.js');
I browserify module-a
. I run it through tests, and everything is good and index.js is produced and it contains foo, bar, and Handlebars and the exports look good and are tested via the requires in the test, so, I npm link module-a
.
I go to module-b
and npm link module-a
, which installs a symlink in the node_modules folder of module-b
.
When I browserify module-b
, which has a statement of var module-a = require('module-a');
, I get a bunch of browserify errors, like the following:
Error: module "./handlebars/base" not found from "/home/blah/Development/module-b/node_modules/module-a/index.js"
This seems strange, since module-a
is already browserified. I’ve tried with -r module-a
, -x module-a
, --ignore-missing
, -i 'handlebars'
. Browserify just keeps spitting out the same error. I assume that it would fail for module-a's
internal ./bar.js
dependency as well, but it dies before it even gets that far.
Is this expected behavior, is it a bug, or am I not configuring the cli call to browserify correctly?
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:18 (2 by maintainers)
Top GitHub Comments
Another option is to minify the result. That way all the
require
functions would get renamed, so they would be ignored by browserify.@zpao @jperkelens So what exactly needs to be done to solve this?