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.

Error: "block.getRootBlock is not a function" in webpack 5.60.0

See original GitHub issue

Bug report

What is the current behavior?

Running a build with module federation yields the following error:

UnhandledPromiseRejectionWarning: TypeError: block.getRootBlock is not a function
    at getBlockModules (node_modules/webpack/lib/buildChunkGraph.js:219:47)

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

Unfortunately, my setup is quite “off road”. It mixes Angular, and module federation with @angular-builders/custom-webpack. So it is difficult for me to provide a minimum repro.

However, I narrowed down the error to version 5.58.0 and above. It works fine with version 5.57.1.

What is the expected behavior?

No such error, or a better error message which tells me why getRootBlock is not a function.

Other relevant information: webpack version: 5.58.0 Node.js version: 14.17.0 Operating System: mac Additional tools: module federation, Angular

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hmilcommented, Nov 19, 2021

One package had declared a dependency on a different version of webpack than the main version declared in my project.

So I ended up with something like:

node_modules/webpack
node_modules/foo/node_modules/webpack

I may also have had some dependency yarn linked from somewhere else at the time of the issue.

Anyways, make sure there is only one webpack in your node_modules, especially deeper down in the module tree.

0reactions
brandonescommented, Nov 18, 2021

Hi @hmil , can you explain a bit more what you mean by “two different copies of webpack”? Where were the two copies located in the directory structure?

I’m having this same problem. And it’s occurring in my CI build, which would seem to mean that npm is installing things wrong from scratch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update typescript block to work with webpack 4 · Issue #296
I'm using webpack-blocks to provide configuration to react-styleguidist and experienced ... ensureHook is not a function TypeError: resolver.
Read more >
Webpack library function is not a function - Stack Overflow
As the title says, i'm getting an error in the browser Uncaught TypeError: MYLIB.init is not a function . webpack.config.js:.
Read more >
To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >
TypeError: this[NS] is not a function at childCompiler.runAsChild
I'm working currently with Webpack in server-side-rendering style. When trying to implement CSS support for my bundles I get this error in…
Read more >
How to Fix Webpack Merge Is Not a Function - Future Studio
This tutorial shows you how to fix the Webpack merge error not being a function.
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