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

Cannot read property 'outputOptions' of undefined

Open FuncWei opened this issue 5 years ago • 6 comments

Compile prompt me: Module build failed: Thread Loader (Worker 0) Cannot read property 'outputOptions' of undefined at PoolWorker.fromErrorObj(...)

FuncWei avatar Jun 05 '19 14:06 FuncWei

Please use issue template

alexander-akait avatar Jun 05 '19 14:06 alexander-akait

Hi, I have the same problem after I abandoned the isomorphic style loader and added a mini css extract pluginin css config:

`import autoprefixer from 'autoprefixer'; import mqpacker from 'css-mqpacker'; import calc from 'postcss-calc'; import partialImport from 'postcss-partial-import'; import postcssUrl from 'postcss-url'; import cssvariables from 'postcss-css-variables'; import mediaVariables from 'postcss-media-variables'; import path from 'path'; import { warmup } from 'thread-loader'; import resolveConfig from '../resolve'; const MiniCssExtractPlugin = require('mini-css-extract-plugin');

warmup({}, [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']); const css = isDev => ({ test: /.css$/, exclude: /node_modules/, use: [ 'thread-loader', { loader: MiniCssExtractPlugin.loader, }, { loader: 'css-loader', options: { modules: true, sourceMap: isDev, importLoaders: 1, localIdentName: '[name][local]_[hash:base64:5]', minimize: isDev, onlyLocals: true, discardComments: { removeAll: true } } }, { loader: 'postcss-loader', options: { ident: 'postcss', plugins: [

      partialImport({
        resolve(id, basedir) {
          if (!/\.css$/.test(id)) id = `${id}.css`;

          // Webpack aliases
          const alias = resolveConfig.alias;
          const aliasesKeys = Object.keys(alias);
          let resolveId;
          for (let alias of aliasesKeys) {
            if (new RegExp(`^${alias}`).test(id)) {
              resolveId = `./${id}`;
              break;
            }
          }

          if (resolveId) {
            return path.resolve(resolveId);
          }

          // From folder
          if (/^\./.test(id)) return path.resolve(basedir, id);

          // Node modules
          return path.resolve('./node_modules', id);
        }
      }),
      mediaVariables(),
      cssvariables(),
      calc(),
      autoprefixer({
        browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9']
      }),
      postcssUrl,
      mediaVariables(),
      mqpacker
    ]
  }
},

], });

export default css; `

likeavenus avatar Jun 05 '20 08:06 likeavenus

Similar error originates here, in the case of css modules.

https://github.com/webpack-contrib/css-loader/blob/v6.2.0/src/utils.js#L530

The loaderContext passed to getModulesOptions does not have a _compilation key. It originates as the loaders this https://github.com/webpack-contrib/css-loader/blob/v6.2.0/src/index.js.

AprilArcus avatar Sep 02 '21 19:09 AprilArcus

How's going?

vagusX avatar May 11 '22 08:05 vagusX

How's going?

thl3538 avatar Dec 06 '22 08:12 thl3538