Webpack's IgnorePlugin causes an "TypeError: Cannot read property 'identifier' of undefined"
See original GitHub issueDo you want to request a feature or report a bug? Bug.
What is the current behavior?
Using webpack.IgnorePlugin
causes compilation to fail with a TypeError: Cannot read property 'identifier' of undefined
message. The full stack trace:
C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:250
const identifier = module.identifier();
^
TypeError: Cannot read property 'identifier' of undefined
at Compilation.addModule (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:250:29)
at moduleFactory.create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:597:34)
at hooks.beforeResolve.callAsync (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\NormalModuleFactory.js:278:23)
at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:18:1)
at AsyncSeriesWaterfallHook.lazyCompileHook [as _callAsync] (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\Hook.js:35:21)
at NormalModuleFactory.create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\NormalModuleFactory.js:268:28)
at semaphore.acquire (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:577:18)
at Semaphore.acquire (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\util\Semaphore.js:16:4)
at Compilation._addModuleChain (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:576:18)
at Compilation.addEntry (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compilation.js:657:8)
at compiler.hooks.make.tapAsync (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\SingleEntryPlugin.js:30:16)
at AsyncParallelHook.eval [as callAsync] (eval at create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:7:1)
at AsyncParallelHook.lazyCompileHook [as _callAsync] (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\Hook.js:35:21)
at hooks.beforeCompile.callAsync.err (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:434:20)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\Hook.js:35:21)
at Compiler.compile (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:427:28)
at readRecords.err (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:217:11)
at Compiler.readRecords (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:324:11)
at hooks.run.callAsync.err (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:214:10)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\Hook.js:35:21)
at hooks.beforeRun.callAsync.err (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:211:19)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\HookCodeFactory.js:24:12), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook [as _callAsync] (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\tapable\lib\Hook.js:35:21)
at Compiler.run (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack\lib\Compiler.js:208:24)
at processOptions (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack-cli\bin\webpack.js:469:20)
at yargs.parse (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack-cli\bin\webpack.js:472:3)
at Object.parse (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\yargs\yargs.js:539:18)
at C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack-cli\bin\webpack.js:196:8
at Object.<anonymous> (C:\dev\workspaces\labtime\design-system\webpack-postcss-cssnext\node_modules\webpack-cli\bin\webpack.js:474:3)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
If the current behavior is a bug, please provide the steps to reproduce. I put up an isolated test case on GitHub: https://github.com/lodybo/webpack-ignoreplugin-iso-testcase.git
There are 2 config files: the normal one (which compiles css files), and a smaller alternate config.
I used the alternate one to provide an isolated test case: npm run webpack -- --config webpack.config-alt.js
What is the expected behavior?
Expected behaviour is that compilation succeeds, and that the file specified by the regex (theme.js
) is not emitted.
If this is a feature request, what is motivation or use case for changing the behavior? See above.
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System. OS: Windows 10 pro Node version: 8.9.4 NPM: 5.6.0 Webpack: 3.10.0 (I also tried this with 4.0.0-beta.0, with the same result).
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:12 (4 by maintainers)
webpack@4 also have this problem
This issue also affects me, same exact versions as @lodybo
Usage: