From 0e44a5ba5be66b291fad46a1709c57becaa3ac03 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Thu, 10 Feb 2022 00:45:58 +0100 Subject: [PATCH] "fix" worker bundling [skip ci] --- scripts/buildUtils.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/scripts/buildUtils.js b/scripts/buildUtils.js index dc6002a6cec8..1dbdf5f00c29 100644 --- a/scripts/buildUtils.js +++ b/scripts/buildUtils.js @@ -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: { @@ -183,7 +197,7 @@ function createWebpackConfigs() { ], }, output: { - filename: 'index.js', + filename: '[name].js', library: { type: 'commonjs2', }, @@ -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; }