Error: "block.getRootBlock is not a function" in webpack 5.60.0
See original GitHub issueBug 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:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
I may also have had some dependency
yarn link
ed 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.
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.