webpack: Error from mini-css-extract-plugin introduced by 4.32.0

Bug report

What is the current behavior?

Module build failed (from /home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js):
  TypeError: Cannot read property 'identifier' of null
      at text.map.line (/home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js:160:32)
      at Array.map (<anonymous>)
      at childCompiler.runAsChild (/home/circleci/project/node_modules/mini-css-extract-plugin/dist/loader.js:157:21)
      at compile (/home/circleci/project/node_modules/webpack/lib/Compiler.js:306:11)
      at hooks.afterCompile.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compiler.js:631:15)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:24:1)
      at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
      at compilation.seal.err (/home/circleci/project/node_modules/webpack/lib/Compiler.js:628:31)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
      at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
      at hooks.optimizeAssets.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compilation.js:1329:35)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:6:1)
      at AsyncSeriesHook.lazyCompileHook (/home/circleci/project/node_modules/tapable/lib/Hook.js:154:20)
      at hooks.optimizeChunkAssets.callAsync.err (/home/circleci/project/node_modules/webpack/lib/Compilation.js:1320:32)
      at _promise1.then._result1 (eval at create (/home/circleci/project/node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:18:1)
      at <anonymous>
   @ ./style/index.ts 1:0-29
   @ multi ./common/errorTracker ./common/polyfills ./style ./frames/about

If the current behavior is a bug, please provide the steps to reproduce.

My configuration is huge. I’d be happy to try and narrow down a minimal repro if necessary, but I hope that the error would be obvious given that this is a regression in a minor release. If it’s not, just let me know.

What is the expected behavior?

There should be no error during build.

Other relevant information: webpack version: 4.32.0 Node.js version: 8.9.0 Operating System: macOS 10.14.5 Additional tools: mini-css-extract-plugin 0.4.4

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 23
  • Comments: 24 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Hello, i found the problem

in file:///…/node_modules/mini-css-extract-plugin/dist/loader.js

in this line try { text = exec(this, source, request); locals = text && text.locals;

the variable “source” has wrong generated code string

Снимок

expected module.i (has value), but is module.id (is undefined)

Does anyone know where the value of the variable “source” is generated?

*Update So, it looks like an error in the file webpack/lib/MainTemplate.js. Object “module” is created with the property “i” but without the property “id” (in my case - module.i === ‘iDYi’, module.id === undefined). after that, the module is registered to exports, where it tries to take the value of the module.id ( == undefined)

*Update2 So, i update this line in MainTemplate.js (“webpack”: “^4.32.0”) and, after that, all compiled fine Снимок

should be fixed in 4.32.1

Very good, I’ve been trying to find the problem all day.