Giter Site home page Giter Site logo

ogzhanolguncu / react-typescript-module-federation Goto Github PK

View Code? Open in Web Editor NEW
167.0 2.0 60.0 1.02 MB

Micro Frontend with React, ReactRouter V6, Typescript and Webpack

Home Page: http://ogz-microfrontend-container.s3-website.eu-central-1.amazonaws.com/

HTML 2.35% TypeScript 52.44% JavaScript 42.71% Shell 2.50%
webpack lerna typescript react module-federation chakra chakra-ui reactjs react-router-v6

react-typescript-module-federation's Introduction

Webpack 5 Module Federation with React/Typescript

s3-deploy

This project consist of three pieces, a host app container and two remotes app1 app2.

Workflow:

  • app1 expose CounterAppOne component.
  • app2 expose CounterAppTwo header component.
  • container import CounterAppOne and CounterAppTwo component.

Running Demo

In order to run the demo I highly recommend installing lerna globally via

npm i -g lerna

Then,

lerna bootstrap

Run the command above at the root of your project. This command will make sure you have dependencies you need in order to run this project.

Finally,

npm run start

Lerna will start all your projects parallelly and open your browser.

Screenshots

App Screenshot

Tech Stack

React, Typescript, Chakra UI, Webpack, Lerna, React Router V6

Article

If you are curious about building this template head over to Introduction to Micro Frontends with Module Federation, React and Typescript

Feedback

If you have any feedback, please reach out to me or feel free to open up a issue.

react-typescript-module-federation's People

Contributors

lucianoayres avatar ogzhanolguncu avatar serhatg35 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-typescript-module-federation's Issues

save in `App.tsx` component is not triggering web browser page reload

Hello, I'm trying to get module federation going by using your starter project, but I'm having issues because of changes not reflecting in web page. Can you please help?

Issue description:

Web page is not reloading with changes after making modifications in app1/src/App.tsx component.

  • before
const App = () => (
  <Box margin="1.2rem">
    <Box>APP-1</Box>

    <Box>
      <CounterAppOne />
    </Box>
  </Box>
);

export default App;
  • after
const App = () => (
  <Box margin="1.2rem">
    <Box>APP-1 this change is not showing in browser after saving</Box>
    <Box>
      <CounterAppOne />
    </Box>
  </Box>
);

export default App;
VM2379 log.js:26 [HMR] Update failed: ChunkLoadError: Loading hot update chunk main failed.
(missing: http://localhost:3001/main.c48a05b….hot-update.js)
    at http://localhost:3001/main.js:1265:26
    at new Promise (<anonymous>)
    at loadUpdateChunk (http://localhost:3001/main.js:1260:20)
    at http://localhost:3001/main.js:1720:29
    at Array.forEach (<anonymous>)
    at Object.__webpack_require__.hmrC.jsonp (http://localhost:3001/main.js:1715:22)
    at http://localhost:3001/main.js:862:47
    at Array.reduce (<anonymous>)
    at http://localhost:3001/main.js:858:55
log.js:24 [HMR] Updated modules:
log.js:24 [HMR]  - ./src/App.tsx
log.js:24 [HMR] App is up to date.

Steps to reproduce:

  1. Clone project
  2. run lerna bootstrap
  3. run npm run start
  4. edit app1\src\App.tsx
  5. save app1\src\App.tsx
  6. http://localhost:3001/ not reloading to reflect changes
  7. console has errors

PS: Same issue happens when running from container

webpack.prod.js missing

Hi There,

Let me thank you for making all these repos. It has been helping me to create MFE architecture using react with typescript. I'm able to create MFE with your repos and has progressed well.

Now, I have to deploy all MFEs to AWS cloud. I have been following your article and repos but somehow webpack.prod.js is missing. I need your help to provide the same. That would me a great help for people like me.

Thanks in advance. Expecting quick response from you.

PS: It would be helpful if you can write or point to an article for deployment to AWS.

Regards,
Nikhil

Routing in apps

As I realize, it doesn't mentioned in this repo how routing can be implemented. Thanks

Readme feedback

I've read a lot of blog posts on module federation and I really like how you have have assembled a proof of concept that provides a foundation to build real world apps!

I'd like to provide a bit of feedback to make diving into your demo that much easier (than it already is) for devs missing a couple things.

  1. npm install --g lerna if you don't already have it installed
  2. yarn within each folder: app1, app2, and container to install the dependencies and then return to the root of the project
  3. yarn build
  4. yarn start

lerna will build & start app1, app2, and the container. Then, open your browser:

Extra polish: you could also link to your amazing article and include a screenshot of the demo.

Again really appreciate your efforts here and it is certainly helping convinces my team mates that is the right way to do MF!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.