thread-loader icon indicating copy to clipboard operation
thread-loader copied to clipboard

🐛 With less-loader: TypeError: this.getLogger is not a function

Open KyrieLii opened this issue 2 years ago • 3 comments

Related to this issue#10.

  • Operating System: macOS 12.5.1
  • Node Version: v16.18.0
  • NPM Version: 8.19.2
  • webpack Version: 5.76.1
  • thread-loader Version: 4.0.2

Expected Behavior

Using with less-loader can work.

Actual Behavior

Error:

TypeError: this.getLogger is not a function
    at Object.lessLoader (/xxx/thread-loader-demo/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/less-loader/dist/index.js:36:23)
    at LOADER_EXECUTION (/xxx/thread-loader-demo/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:132:14)
    at runSyncOrAsync (/xxx/thread-loader-demo/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:133:4)
    at iterateNormalLoaders (/xxx/thread-loader-demo/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:251:2)
    at /xxx/thread-loader-demo/node_modules/.pnpm/[email protected]/node_modules/loader-runner/lib/LoaderRunner.js:224:4
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

Code

https://github.com/KyrieLii/thread-loader-demo/blob/main/webpack.config.js

How Do We Reproduce?

git clone [email protected]:KyrieLii/thread-loader-demo.git

npm i -g pnpm@7

pnpm install

pnpm start

KyrieLii avatar Jun 03 '23 15:06 KyrieLii

If nobody follows up, I will attempt to help fix this issue. (when I have time 😂)

KyrieLii avatar Jun 03 '23 15:06 KyrieLii

I fixed this some time ago in https://github.com/webpack-contrib/thread-loader/pull/130, never got merged tho. Feel free to pick up from the work in that PR!

benjamin-hodgson avatar Jul 23 '23 14:07 benjamin-hodgson

@benjamin-hodgson Sorry for delay, let's finish https://github.com/webpack-contrib/thread-loader/pull/130, we need to remap all methods from webpack logger, i.e. webpack logger has .time()/.trace() and etc methods, so to finish it we need to support all of them, i.e. https://github.com/webpack/webpack/blob/main/lib/logging/Logger.js#L38, thank you

alexander-akait avatar Aug 07 '23 16:08 alexander-akait