browserify / browserify/webworkify

Deduped modules don't get included in worker blob

Open
#41 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
419
Forks
34
PR merge metrics
No merged PRs in 30d

Description

This causes an exception at runtime when the missing module is required.

The `resolveSources` function tries to recursively find all dependencies, but it doesn't know about modules that are deduped, which have an entry in the modules map that looks like this:

```js
"/Users/jhiesey/Projects/node/stream-http/node_modules/inherits/inherits_browser.js": [function(require, module, exports) {
arguments[4]["/Users/jhiesey/Projects/node/airtap/node_modules/inherits/inherits_browser.js"][0].apply(exports, arguments)
}
, {}]
```

The module the dedupe entry points to ("/Users/jhiesey/Projects/node/airtap/node_modules/inherits/inherits_browser.js") needs to be included too, but `resovleSources` doesn't know that, so the dedupe entry throws at runtime.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the resolveSources function and tracing how it walks the modules map, then inspect the dedupe entry and its target module path. Reproduce the worker runtime exception with a deduped dependency; done means the referenced module is included in the worker blob and requiring it succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.