[ HW | ISSUE ]: webpack build successful, but RemoteComponent giving issues
See original GitHub issueOn react building i have this error
Module not found: Error: Can't resolve 'http' in '.../node_modules/@paciolan/remote-module-loader/dist/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
What is my option here? I just want simply to load a webpack bundle from server…
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Issues · Paciolan/remote-component - GitHub
Contribute to Paciolan/remote-component development by creating an account ... [ HW | ISSUE ]: webpack build successful, but RemoteComponent giving issues ...
Read more >How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >Webpack dev server compiling successfully but reload or ...
I'm having problems with the webpack dev server, when running the script npm run frontend (during development) to see changes in the browser ......
Read more >How to Use Webpack Module Federation in React
Module Federation is an excellent tool for constructing a micro-frontend architecture in React applications. I will show you how to use it in...
Read more >Build Performance - webpack
Newer versions create more efficient module trees and increase resolving speed. Loaders. Apply loaders to the minimal number of modules necessary. Instead of:...
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 Free
Top 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

Ok it appears Webpack 5 has a BREAKING CHANGE. I am guessing create-react-app 5 switched to Webpack 5.
So there are a few (not so great) options.
Not sure how long it will take for the upgrade. Still need to do some testing and the change I am thinking of will also create a breaking change in the remote-component.
Hi @joelnet,
The root cause of the problem with webpack 5 is one of the dependency
remote-module-loaderis importing a node version of fetcher into browser without polyfill. https://github.com/Paciolan/remote-module-loader/blob/b9558d5651300cbb183eea5804619cd09a5432d9/src/lib/nodeFetcher.ts#L1Packages like
httpandhttpsare not available in browser, andXMLHTTPRequestis not available in node. I think an easier solution without introducing breaking change would be removingnodeFetcherandxmlHttpRequestFetcherin https://github.com/Paciolan/remote-module-loader/tree/b9558d5651300cbb183eea5804619cd09a5432d9/src/lib and useaxios(as it is isomorphic) in https://github.com/Paciolan/remote-module-loader/blob/b9558d5651300cbb183eea5804619cd09a5432d9/src/lib/loadRemoteModule.tsIf we are no longer interested in supporting old node versions below 17.5 and old IE, we can use the newly introduced
fetch APIas default fetcher.For anyone who want to stay with webpack 5 and does not eject, you can use
react-app-rewiredto add resolve.fallback: { “http”: false, “https”: false }