何从e何去

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ReferenceError: document is not defined
    at insertStyleElement (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:309:15)
    at addStyle (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:424:13)
    at modulesToDom (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:297:18)
    at module.exports.module.exports (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:455:25)
    at Object.<anonymous> (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:206:14)
    at __webpack_require__ (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:21:30)
    at E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:85:18
    at Object.<anonymous> (E:\webs\test\node_modules\style-loader\dist\cjs.js!E:\webs\test\node_modules\css-loader\dist\cjs.js!E:\webs\test\node_modules\postcss-loader\src\index.js??ref--4-3!E:\webs\test\node_modules\stylus-loader\index.js!E:\webs\test\client\assets\styles\footer.styl:88:10)
    at Module._compile (E:\webs\test\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
    at evalModuleCode (E:\webs\test\node_modules\mini-css-extract-plugin\dist\loader.js:66:10)
    at E:\webs\test\node_modules\mini-css-extract-plugin\dist\loader.js:196:31
    at E:\webs\test\node_modules\webpack\lib\Compiler.js:343:11
    at E:\webs\test\node_modules\webpack\lib\Compiler.js:681:15
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at E:\webs\test\node_modules\webpack\lib\Compiler.js:678:31
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at E:\webs\test\node_modules\webpack\lib\Compilation.js:1423:35
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at E:\webs\test\node_modules\webpack\lib\Compilation.js:1414:32
    at eval (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:11:1)
    at E:\webs\test\node_modules\terser-webpack-plugin\dist\index.js:321:9
    at TaskRunner.run (E:\webs\test\node_modules\terser-webpack-plugin\dist\TaskRunner.js:48:7)
    at TerserPlugin.optimizeFn (E:\webs\test\node_modules\terser-webpack-plugin\dist\index.js:227:18)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at E:\webs\test\node_modules\webpack\lib\Compilation.js:1409:36
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at E:\webs\test\node_modules\webpack\lib\Compilation.js:1405:32
    at AsyncSeriesHook.eval [as callAsync] (eval at create (E:\webs\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (E:\webs\test\node_modules\tapable\lib\Hook.js:154:20)
    at Compilation.seal (E:\webs\test\node_modules\webpack\lib\Compilation.js:1342:27)

 搞了一个下午,原来是加多了style-loader

{
    test: /\.styl$/,
    use: [
      MiniCssExtractPlugin.loader,
      'style-loader', //要删除这个loader,不然一直报错
      'css-loader',
      {
        loader: 'postcss-loader',
        options: {
          sourceMap: true
        }
      },
      'stylus-loader'
    ]
  }

  

 

posted on 2020-09-02 09:41  何从e何去  阅读(6967)  评论(0编辑  收藏  举报