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.

Chunksplitting leads to Cannot read property 'call' of undefined

See original GitHub issue

Bug report

What is the current behavior? When chunksplitting with the default setup as described here https://webpack.js.org/plugins/split-chunks-plugin/#optimizationsplitchunks, splitting chunks leads to the original chunk to only include one module and that modules moduleId is the path instead of the number that is used in the runtime code to require this module. The right chunk is loaded but the webpack_modules only includes the path instead of the module id(eg 1880) and leads to Cannot read property ‘call’ of undefined. The mode is set to none.

If the current behavior is a bug, please provide the steps to reproduce. It is tough to reproduce since this is a chunksplitting done with the standard chunksplitting settings. Maybe due to the knowledge of @sokra this could be fixed, because maybe this is a very specific issue and he knows where to look exactly?

What is the expected behavior? That the module id is included in the chunk instead of the path to the module. Then the webpack_require should also work correctly. This seems to be a very specific issue and maybe this can be fixed swiftly by one who knows the code around this area.

Other relevant information: webpack version: 5.16.0 Node.js version: 12.17.0 Operating System: macOS Additional tools:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (32 by maintainers)

github_iconTop GitHub Comments

1reaction
primozscommented, Mar 21, 2021

Production build Upgrading from “webpack”: “^5.22.0”, to “webpack”: “^5.23.0” and all versions above I get

Cannot read property 'call' of undefined
    at __webpack_require__ ( ...build/dist/server/main.js:2:8428129)
...

not using anything “special” Screenshot 2021-03-21 at 10 25 57

1reaction
janlent1commented, Mar 11, 2021

@alexander-akait also when I set the moduleIds: false, I get possible oom node js errors/breakpoints in the nodejs devtools in the RuntimeTemplate within the function noModuleIdErrorMessage. If this build doesn’t work again, I will reset it to 'natural’or just leave it out of the config as previously done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'call' of ...
My code no longer works in production either. I am getting the following error: Uncaught (in promise) TypeError: Cannot read property 'call ...
Read more >
jest cannot spy the property because it is not a function
The call to .promise should result in invoking the mock. It instead says cannot read property 'promise' of undefined , indicating that the...
Read more >
SplitChunksPlugin
The name of the split chunk. Providing false will keep the same name of the chunks so it doesn't change names unnecessarily. It...
Read more >
webpack/webpack - Gitter
Uncaught TypeError : Cannot read property 'call' of undefined ... the callback is executed, even though calling the module failed due to the...
Read more >
Solved: Intermittent JS errors (Cannot read property 'call...
Intermittent JS errors (Cannot read property 'call' of undefined) with embedding ... Sometimes, when a report is embedded with the Power BI JS...
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