developit / developit/workerize-loader

Fails when a depedency (module) requires a webpack "external" module

Open
#22 3 comments 4 reactions 0 assignees View on GitHub
help wanted question
Dominant language
JavaScript
Stars
2.3k
Forks
85
PR merge metrics
No merged PRs in 30d

Description

Awesome library! I've just found an edge case when workerizing a module that depends on a webpack external.

In my webpack config i have:
```javascript
module.exports = {
// ...
externals: {
'config': JSON.stringify(config),
},
// ...
}
```

and in my worker module I have:
```typescript
import * as config from 'config';
```

I'm using typescript in case that matters.

Here's the compilation error from webpack:
```bash
Module not found: Error: Can't resolve 'config' in '/directory/src'
@ ./src/MyWorker.ts 1:0-33
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the webpack build using the shown externals configuration and the MyWorker.ts import. Trace how workerize-loader handles dependencies marked as webpack externals; done means the worker module compiles while resolving the external config module.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript, webpack
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.