Repository navigation
Incompatibility with css-loader due to its use of createHash #208
Description
Activity
- changed the title
[-]Incompatibility with css-loader[/-][+]Incompatibility with css-loader due to its use of createHash[/+]on Mar 18, 2024 We need to pass
utilapi to to loader context, feel free to send a PRAny news?
The latest version should work. What problems/errors do you have?
@alexander-akait I'm already using the latest version, the issue is with monaco-editor:
ERROR in ./node_modules/monaco-editor/esm/vs/editor/editor.main.js Module build failed (from ./node_modules/thread-loader/dist/cjs.js): Thread Loader (Worker 0) this.utils.contextify is not a function at stringifyRequest (/Users/itsmepetrov/Documents/Projects/sprut/sprut.web/node_modules/monaco-editor-webpack-plugin/out/loaders/include.js:15:46) at /Users/itsmepetrov/Documents/Projects/sprut/sprut.web/node_modules/monaco-editor-webpack-plugin/out/loaders/include.js:23:43 at Array.map (<anonymous>) at Object.pitch (/Users/itsmepetrov/Documents/Projects/sprut/sprut.web/node_modules/monaco-editor-webpack-plugin/out/loaders/include.js:23:16) @ ./modules/monaco-editor/index.js 2:0-46 78:20-72 84:18-30 96:20-72 @ ./plugins/monaco-editor.js 2:0-49 4:16-33 4:35-47 @ ./core/plugins.ts 16:2-37 @ ./core/main.ts 12:0-41 38:2-14 webpack 5.97.1 compiled with 1 error in 16172 msReacted by Michael James@itsmepetrov Yeah, I see, we need to improve this place - https://github.com/webpack-contrib/thread-loader/blob/master/src/worker.js#L379, we already export
require('webpack').util.contextify, so we need to make the same as forcreateHash, do you want to send a PR?@alexander-akait even with that fix there's still a problem with this line:
any suggestions on how to "pass"
loaderContext._compilation.getPathtocss-loaderwhen it's wrapped by thread-loader?@mjames-c We need to fix it here, do you want to send a PR?
@alexander-akait i'd be happy to send a PR but i'd need some guidance on "polly-filling"
loaderContext._compilation.getPath--getPath()seems to use many webpack internals (such asthis.hooks.assetPath.call):it's not clear to me how i would be able to replicate this in
thread-loader's worker.js@mjames-c We should do it like this - https://github.com/webpack-contrib/thread-loader/blob/master/src/worker.js#L173
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority


2010.5.05.90.34.0.2Expected Behavior
thread-loaderis compatible withcss-loaderActual Behavior
The following exception is raised at runtime
Code
css-loaderexpects to be able to create hashes via an exposed loader/webpack api.thread-loaderdoesn't expose these over the processes bridge so hitting this code will always errror.How Do We Reproduce?
Specifying any of the
localIdentconfiguration options oncss-loaderand running it inthread-loadershould be enough to repro.Additional questions
I reported this as a bug since it seemed previously compatibility with
css-loaderwas intended. If that's still the case, is there a better way for them to create hashes?