Skip to content

Is exposed name from b.require() supposed to be available inside bundle? #1137

Open

Description

@jmm

The documentation for b.require() says:

Make file available from outside the bundle with require(file).

This doesn't communicate any relationship between b.require()d files and other files in the same bundle. However, people frequently use b.require() to expose a file under an alias that they then use to require the file in other files in the bundle, e.g.:

bundler.js

browserify('./entry').require('./x', {expose: "whatever"});

entry.js

require('whatever');

I believe some of browserify's tests of b.require() even rely on that.

If that behavior is intended it should be documented, and if it's not intended the documentation should note that to make it clear. I think it's a useful feature, if it doesn't interfere with any other use cases. There is currently a lot of flakiness in browserify about matching up values passed / configured via things like b.require(), require() calls in bundled files, browser field etc. though, so getting the documentation tightened up re: what should happen would be very beneficial.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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