Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'outputOptions' of undefined #66

Open
FuncWei opened this issue Jun 5, 2019 · 6 comments
Open

Cannot read property 'outputOptions' of undefined #66

FuncWei opened this issue Jun 5, 2019 · 6 comments

Comments

@FuncWei
Copy link

FuncWei commented Jun 5, 2019

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

@alexander-akait
Copy link
Member

Please use issue template

@likeavenus
Copy link

likeavenus commented Jun 5, 2020

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;
`

@AprilArcus
Copy link

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.

@vagusX
Copy link

vagusX commented May 11, 2022

How's going?

1 similar comment
@thl3538
Copy link

thl3538 commented Dec 6, 2022

How's going?

@xsfxtsxxr
Copy link

Try to use "css-loader": "1.0.1" and "thread-loader": "^3.0.4"

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

No branches or pull requests

7 participants