Skip to content

Conversation

@qnighy
Copy link
Contributor

@qnighy qnighy commented Oct 27, 2020

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

When used with sass-loader and { sourceMap: true }, it fails with the following message:

[2] ERROR in ./path/tofoo.scss
[2] Module build failed (from $CWD/node_modules/mini-css-extract-plugin/dist/loader.js):
[2] ModuleBuildError: Module build failed (from $CWD/node_modules/thread-loader/dist/cjs.js):
[2] Thread Loader (Worker 9)
[2] The "path" argument must be of type string. Received undefined
[2]     at PoolWorker.fromErrorObj ($CWD/node_modules/thread-loader/dist/WorkerPool.js:344:12)
[2]     at $CWD/node_modules/thread-loader/dist/WorkerPool.js:217:29
[2]     at validateString (internal/validators.js:124:11)
[2]     at Object.join (path.js:1039:7)
[2]     at getSassOptions ($CWD/node_modules/sass-loader/dist/utils.js:160:37)
[2]     at Object.loader ($CWD/node_modules/sass-loader/dist/index.js:36:49)
[2]     at $CWD/node_modules/webpack/lib/NormalModule.js:316:20
[2]     at $CWD/node_modules/loader-runner/lib/LoaderRunner.js:367:11
[2]     at $CWD/node_modules/loader-runner/lib/LoaderRunner.js:182:20
[2]     at context.callback ($CWD/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
[2]     at Object.callback ($CWD/node_modules/thread-loader/dist/index.js:51:7)
[2]     at done ($CWD/node_modules/neo-async/async.js:8069:18)
[2]     at callback ($CWD/node_modules/thread-loader/dist/WorkerPool.js:183:19)
[2]     at $CWD/node_modules/thread-loader/dist/WorkerPool.js:217:15
[2]     at mapSeries ($CWD/node_modules/neo-async/async.js:3625:14)
[2]     at PoolWorker.onWorkerMessage ($CWD/node_modules/thread-loader/dist/WorkerPool.js:171:34)
[2]     at $CWD/node_modules/thread-loader/dist/WorkerPool.js:144:14
[2]     at Socket.onChunk ($CWD/node_modules/thread-loader/dist/readBuffer.js:40:9)
[2]     at Socket.emit (events.js:315:20)
[2]     at Socket.Readable.read (_stream_readable.js:519:10)
[2]     at Socket.read (net.js:625:39)
[2]     at flow (_stream_readable.js:992:34)

This PR fixes the problem by passing context.rootContext into workers.

Breaking Changes

Additional Info

@codecov
Copy link

codecov bot commented Oct 27, 2020

Codecov Report

Merging #104 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #104   +/-   ##
=======================================
  Coverage   20.30%   20.30%           
=======================================
  Files           7        7           
  Lines         458      458           
  Branches       86       86           
=======================================
  Hits           93       93           
  Misses        322      322           
  Partials       43       43           
Impacted Files Coverage Δ
src/index.js 63.63% <ø> (ø)
src/worker.js 0.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77a4ff2...99e3024. Read the comment docs.

@alexander-akait
Copy link
Member

Thanks

@alexander-akait alexander-akait merged commit 8e56785 into webpack:master Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants