New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-app-rewire-micro-frontends

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-app-rewire-micro-frontends

Modifies react-scripts 2.0 for micro frontend development

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

react-app-rewire-micro-frontends

This package makes a couple of modifications to react-scripts 2.0 for the purpose of building microfrontends

Single chunk

In react-scripts v1, your JavaScript was always compiled to a single file. In 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.

Externals

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.

Installation

  • Install required dependencies:

    yarn add -D react-app-rewired react-app-rewire-micro-frontends
    
  • Edit your package.json scripts to use react-app-rewired instead of react-scripts.

  • Add this line to your package.json:

      "config-overrides-path": "node_modules/react-app-rewire-micro-frontends",
    

That's it! Your app should now be compiled to just /static/js/bundle.js in dev mode, or main.[hash].js for production builds, and in either case the compiled code will not include react or react-dom.

FAQs

Package last updated on 15 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts