Kizmar / single-spa-cra2

An example using single-spa with three create-react-apps (react-scripts 2.0.4)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single-spa & create-react-app (react-scripts 2.0.4)

This is a very simple micro frontend proof of concept using three create-react-apps and single-spa. This is by no means production ready.

The changes I made were heavily influenced by this post by Łukasz Kyć at Pragmatists. If you want more detail about what I'm doing here, you are better off checking out his post. I made a few adjustments from what he talks about, but the important changes are in the webpack.config.prod.js file to work with react-scripts version 2.0.4. I'm also using a seperate entry point file (singleSpa.js) instead of overwriting index.js. This allows us to run the app on localhost while developing (or should... that's the idea anyway, I haven't actually tried it).

I'll let the commits do the rest of the talking for me.

To run this:

  • Run yarn install within each app directory
  • In three seperate terminal windows run the following:
    • Run yarn serve inside child-one
    • Run yarn serve inside child-two
    • Run yarn start inside parent

Additional Resources:

About

An example using single-spa with three create-react-apps (react-scripts 2.0.4)


Languages

Language:JavaScript 95.2%Language:HTML 3.2%Language:CSS 1.7%