browserify / browserify/browserify

Controlling exposure of bundled modules

Open
#1,039 2 comments 0 reactions 0 assignees View on GitHub
path-matching
Dominant language
JavaScript
Stars
14.7k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to make sense of how to control exposure of modules in a bundle and finding the documentation and behavior difficult to follow.

Given browserify 7.0.3 or 8.0.3 and this directory structure:

```
- somedir
bundle.js
- src
a.js
b.js
c.js
```
#1)

Is this situation supposed to break the bundle? (does for me):

``` js
// src/a.js
require('./b');
```

``` js
// bundle.js
browserify('./src/a')
.require('./src/b')
```

Result (when bundle loaded in browser):

```
Uncaught Error: Cannot find module './b'
```
#2)

Is this situation supposed to happen?:

``` js
// src/b.js
module.exports = "This is b.js";
```

``` js
browserify('./src/a')
.require('./src/c')
```

``` html

// Logs "This is b.js"
console.log(require(2));

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.