Using Remote Component with CRA
See original GitHub issueHi,
nice library and very well documented, thank you for your effort!
I am having trouble using it within a regular Create React App (without ejecting or rewiring) and would appreciate any advice…
I am getting an error when I start my app:
Module not found: Can't resolve 'remote-component.config.js' in '/path/to/my/app/node_modules/@paciolan/remote-component/dist/lib'
Which later results in: Could not require 'react'. 'react' does not exist in dependencies.
I assume this is because CRA doesn’t use webpack.config.js… Do you maybe know a way around it which would not require ejecting or rewiring the app?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Paciolan/remote-component: Dynamically load a React ...
A Remote Components is loaded at runtime from a URL. It is used in the same way any other React Component is used....
Read more >Microfrontend Module Federation: Exposing Remote from ...
Exposing as a Remote When you browse to http://localhost:8001/remoteEntry.js, you should be able to see the file. This is the file that you...
Read more >Building React App with Module Federation and NextJS/React
Preferable not created using CRA(create react app); At least one React Component; One will be the host app; The other will a remote...
Read more >Loading external esmodule on Create React App (w/o ejection)
Is there a way to dynamically load an external component from a remote location on a CRA project w/o the need to eject...
Read more >Deployment | Create React App
git remote set-url origin https://<user>:<token>@github.com/<user>/<repo> . Try npm run deploy again. "Cannot read property 'email' of null".
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

I updated the docs to include the changes required to get Remote Component working with Create React App.
https://github.com/Paciolan/remote-component#create-react-app
I also made a note about that Warning message that appears.
https://github.com/Paciolan/remote-component#you-may-see-some-warnings
I was able to get CRA working with the RemoteComponent without using eject.
I followed the manual configuration section.
Some changes I needed to make:
I moved
remote-component.config.jsintosrc/remote-component.config.jsThen I create
src/components/RemoteComponent.js. I pointed to the new location forsrc/remote-component.config.js. I also had to change the imports.The error message seems to be from eager loading of RemoteComponent, even though it’s not used. I’m gonna work on changing this to be lazy in the next version.