Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ReferenceError: document is not defined
at insertStyleElement (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:309:15)
at addStyle (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:424:13)
at modulesToDom (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:297:18)
at module.exports.module.exports (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:455:25)
at Object.<anonymous> (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:206:14)
at __webpack_require__ (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:21:30)
at E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:85:18
at Object.<anonymous> (E:webs est
ode_modulesstyle-loaderdistcjs.js!E:webs est
ode_modulescss-loaderdistcjs.js!E:webs est
ode_modulespostcss-loadersrcindex.js??ref--4-3!E:webs est
ode_modulesstylus-loaderindex.js!E:webs estclientassetsstylesfooter.styl:88:10)
at Module._compile (E:webs est
ode_modulesv8-compile-cachev8-compile-cache.js:194:30)
at evalModuleCode (E:webs est
ode_modulesmini-css-extract-plugindistloader.js:66:10)
at E:webs est
ode_modulesmini-css-extract-plugindistloader.js:196:31
at E:webs est
ode_moduleswebpacklibCompiler.js:343:11
at E:webs est
ode_moduleswebpacklibCompiler.js:681:15
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at E:webs est
ode_moduleswebpacklibCompiler.js:678:31
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at E:webs est
ode_moduleswebpacklibCompilation.js:1423:35
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at E:webs est
ode_moduleswebpacklibCompilation.js:1414:32
at eval (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:11:1)
at E:webs est
ode_modules erser-webpack-plugindistindex.js:321:9
at TaskRunner.run (E:webs est
ode_modules erser-webpack-plugindistTaskRunner.js:48:7)
at TerserPlugin.optimizeFn (E:webs est
ode_modules erser-webpack-plugindistindex.js:227:18)
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:7:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at E:webs est
ode_moduleswebpacklibCompilation.js:1409:36
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at E:webs est
ode_moduleswebpacklibCompilation.js:1405:32
at AsyncSeriesHook.eval [as callAsync] (eval at create (E:webs est
ode_modules apablelibHookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (E:webs est
ode_modules apablelibHook.js:154:20)
at Compilation.seal (E:webs est
ode_moduleswebpacklibCompilation.js:1342:27)
搞了一个下午,原来是加多了style-loader
{
test: /.styl$/,
use: [
MiniCssExtractPlugin.loader,
'style-loader', //要删除这个loader,不然一直报错
'css-loader',
{
loader: 'postcss-loader',
options: {
sourceMap: true
}
},
'stylus-loader'
]
}