question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'jsonData' of undefined

See original GitHub issue

Please 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:closed
  • Created 2 years ago
  • Reactions:31
  • Comments:20 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
alexander-akaitcommented, Jul 3, 2021

We will fix it in near future, sorry

6reactions
alexander-akaitcommented, Jul 2, 2021

Critical

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'jsonData' of undefined (webpack5 and ...
Describe the bug I started a project using npx sb init --builder webpack5 and chose html for my future components. I cannot edit...
Read more >
JSON - Cannot read property of undefined - Stack Overflow
I have an issue when trying to get some data from a json. Usually I have to hardcode the JSON variable I want...
Read more >
My result cannot read properties of undefined (reading 'length ...
Your result is not an array; it's an object which happens to have numeric property names. If you want to iterate over the...
Read more >
Cannot read properties of undefined (reading 'id') - TrackJS
TypeError is a subset of JavaScript Error that is thrown when code attempts to do something that does not exist on the target...
Read more >
TypeError: Cannot read properties of undefined (reading 'json')
Update: No need to use ".then" since I am using "async await" in my fetch API function. Removed those lines and no more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found