TypeError: Cannot read property 'jsonData' of undefined
See original GitHub issuePlease excuse that the bug report is quite short. I don’t have time to debug the problem myself today. Since the bug doesn’t come from other dependencies according to the stacktrace and the only change since the last usage is in the webpack version, I post the bug report anyway.
Bug report
What is the current behavior?
The build process crashes when watching for changes. The first build works fine, on saving a file, the process throws the folloging error.
let data = module.buildInfo.jsonData;
^
TypeError: Cannot read property 'jsonData' of undefined
at JsonGenerator.getSize (./node_modules/webpack/lib/json/JsonGenerator.js:119:31)
at NormalModule.size (./node_modules/webpack/lib/NormalModule.js:1224:43)
at NormalModule.cleanupForCache (./node_modules/webpack/lib/NormalModule.js:364:9)
at NormalModuleFactory.cleanupForCache (./node_modules/webpack/lib/NormalModuleFactory.js:670:11)
at Compiler._cleanupLastNormalModuleFactory (./node_modules/webpack/lib/Compiler.js:383:34)
at Compiler.createNormalModuleFactory (./node_modules/webpack/lib/Compiler.js:1049:8)
at Compiler.newCompilationParams (./node_modules/webpack/lib/Compiler.js:1071:30)
at Compiler.compile (./node_modules/webpack/lib/Compiler.js:1082:23)
at ./node_modules/webpack/lib/Watching.js:188:19
at Hook.eval [as callAsync] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
If the current behavior is a bug, please provide the steps to reproduce.
I will update the instructions to reproduce the error next week if necessary.
What is the expected behavior?
module.buildInfo
seems to be undefined, although it shouldn’t be. When I replace the line with let data = module?.buildInfo?.jsonData;
it works fine but I don’t think this would be a good solution.
Other relevant information: webpack version: 5.42.0 throws the error. 5.41.0 seems to be working Node.js version: v16.4.0, v12.x of my coworker didn’t work aswell Operating System: Windows Additional tools: Custom CLI with embedded webpack.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:31
- Comments:20 (5 by maintainers)
Top GitHub Comments
We will fix it in near future, sorry
Critical