Skip to content

Commit 32749e5

Browse files
arcanisgaearon
authored andcommitted
Forwards args through thread-loader (facebook#5157)
* Forwards args through thread-loader * Comments & dev
1 parent 914f7e1 commit 32749e5

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

Diff for: config/webpack.config.dev.js

+10
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ module.exports = {
225225
loader: require.resolve('thread-loader'),
226226
options: {
227227
poolTimeout: Infinity, // keep workers alive for more effective watch mode
228+
// Forwards the process args (such as --require) to the child
229+
// workers. Ensures that the worker operates in the same kind
230+
// of environment than the current one (important in case a
231+
// preloaded script modifies the env)
232+
workerNodeArgs: process.execArgv,
228233
},
229234
},
230235
{
@@ -284,6 +289,11 @@ module.exports = {
284289
loader: require.resolve('thread-loader'),
285290
options: {
286291
poolTimeout: Infinity, // keep workers alive for more effective watch mode
292+
// Forwards the process args (such as --require) to the child
293+
// workers. Ensures that the worker operates in the same kind
294+
// of environment than the current one (important in case a
295+
// preloaded script modifies the env)
296+
workerNodeArgs: process.execArgv,
287297
},
288298
},
289299
{

Diff for: config/webpack.config.prod.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,16 @@ module.exports = {
277277
use: [
278278
// This loader parallelizes code compilation, it is optional but
279279
// improves compile time on larger projects
280-
require.resolve('thread-loader'),
280+
{
281+
loader: require.resolve('thread-loader'),
282+
options: {
283+
// Forwards the process args (such as --require) to the child
284+
// workers. Ensures that the worker operates in the same kind
285+
// of environment than the current one (important in case a
286+
// preloaded script modifies the env)
287+
workerNodeArgs: process.execArgv,
288+
},
289+
},
281290
{
282291
// We need to use our own loader until `babel-loader` supports
283292
// customization
@@ -332,7 +341,16 @@ module.exports = {
332341
use: [
333342
// This loader parallelizes code compilation, it is optional but
334343
// improves compile time on larger projects
335-
require.resolve('thread-loader'),
344+
{
345+
loader: require.resolve('thread-loader'),
346+
options: {
347+
// Forwards the process args (such as --require) to the child
348+
// workers. Ensures that the worker operates in the same kind
349+
// of environment than the current one (important in case a
350+
// preloaded script modifies the env)
351+
workerNodeArgs: process.execArgv,
352+
},
353+
},
336354
{
337355
loader: require.resolve('babel-loader'),
338356
options: {

0 commit comments

Comments
 (0)