developit/workerize-loader

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

Ouverte

#22 ouverte le 14 févr. 2018

 (3 commentaires) (4 réactions) (0 personne assignée)JavaScript (111 forks)batch import
help wantedquestion

Métriques du dépôt

Stars
 (2 296 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

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:

module.exports = {
  // ...
  externals: {
    'config': JSON.stringify(config),
  },
  // ...
}

and in my worker module I have:

import * as config from 'config';

I'm using typescript in case that matters.

Here's the compilation error from webpack:

Module not found: Error: Can't resolve 'config' in '/directory/src'
 @ ./src/MyWorker.ts 1:0-33

Guide contributeur