Skip to content

Browserify a Browserified module #374

@jackcviers

Description

@jackcviers

So 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions