Skip to content

Commit

Permalink
"fix" worker bundling [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 27, 2022
1 parent 633e8e2 commit 0e44a5b
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions scripts/buildUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,21 @@ function createWebpackConfigs() {
pkg,
webpackConfig: {
devtool: false,
entry: input,
entry: {
index: input,
...(pkg.name === 'jest-worker'
? {
processChild: path.resolve(
path.dirname(input),
'./workers/processChild.ts',
),
threadChild: path.resolve(
path.dirname(input),
'./workers/threadChild.ts',
),
}
: {}),
},
externals: nodeExternals(),
mode: 'production',
module: {
Expand All @@ -183,7 +197,7 @@ function createWebpackConfigs() {
],
},
output: {
filename: 'index.js',
filename: '[name].js',
library: {
type: 'commonjs2',
},
Expand Down Expand Up @@ -218,6 +232,14 @@ class IgnoreDynamicRequire {
if (!arg.isString() && !arg.isConditional()) {
return true;
}

if (
arg.isString() &&
(arg.string === './threadChild' ||
arg.string === './processChild')
) {
return true;
}
return undefined;
}

Expand Down

0 comments on commit 0e44a5b

Please sign in to comment.