This package makes a couple of modifications to react-scripts 2.0 for the purpose of building microfrontends
version 2, code splitting is enabled by default, so your application will be
split into several 'chunks' which can be loaded onto the page indepedently. This
makes it much more difficult to dynamically download the required scripts into
an HTML file other than the one that react-scripts generates. So this rewiring
puts things back into a single chunk.
To save bandwidth, react and react-dom are excluded from the compiled code, and are expected to be present on the page as scripts instead.
Install required dependencies:yarn add -D react-app-rewired react-app-rewire-micro-frontends
package.jsonscripts to use
Add this line to your
That's it! Your app should now be compiled to just
/static/js/bundle.js in dev
main.[hash].js for production builds, and in either case the compiled
code will not include react or react-dom.