thread-loader
thread-loader copied to clipboard
Cannot read property 'outputOptions' of undefined
Compile prompt me: Module build failed: Thread Loader (Worker 0) Cannot read property 'outputOptions' of undefined at PoolWorker.fromErrorObj(...)
Please use issue template
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; `
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.
How's going?
How's going?