webpack-contrib / thread-loader

Runs the following loaders in a worker pool
MIT License
1.12k stars 69 forks source link

this.getOptions is not a function #197

Closed szylmzs closed 9 months ago

szylmzs commented 10 months ago

I get error with "this.getOptions is not a function" when using thread-loader, and below is config

addWebpackModuleRule(
    {
      test: /\.(js|ts)x?$/i,
      use: [
        {
          loader: require.resolve('thread-loader'),
          options: {
            workers: 2
          }
        },
        {
          loader: require.resolve('babel-loader'),
          options: {
            customize: require.resolve('babel-preset-react-app/webpack-overrides')
          }
        }
      ],
      exclude: /node_modules/
    },
    {
      test: /\.less$/i,
      use: [
        {
          loader: require.resolve('thread-loader'),
          options: {
            workers: 2
          }
        },
        {
          loader: 'less-loader',
          options: { paths: [path.resolve(__dirname, 'node_modules')] }
        }
      ],
      exclude: /node_modules/
    }
  )
szylmzs commented 10 months ago

resolved by downgrade version to 3, but a new issue occurs, seems that take no effect for babel-loader image

szylmzs commented 10 months ago

I found the reason thread-loader can not handle files in node_modules and I have mounts of dependencies how to resolve?

alexander-akait commented 9 months ago

Please use the issue template, sorry I don't undestand the problem, we have https://github.com/webpack-contrib/thread-loader/blob/master/src/worker.js#L169 and support this.getOptions()

zjtt commented 2 months ago

bro, I have the same problem, how to solve it.

IsDyh01 commented 1 month ago

bro, I have the same problem, how to solve it.

I have the same problem. How can I solve it

alexander-akait commented 1 month ago

You need to update your webpack to 5 version