Giter Club home page Giter Club logo

craco-plugin-single-spa-application's Introduction

craco-plugin-single-spa-application

Convert your CRA4 project into a single-spa application without ejecting and losing update support of react-scripts

Install

npm install craco-plugin-single-spa-application --save-dev

Usage

  1. Add the plugin into your craco.config.js;
singleSpaApplicationPlugin = require('craco-plugin-single-spa-application');

module.exports = {
    plugins: [{
        plugin: singleSpaApplicationPlugin,
        options: {
        orgName: "my-org",
        projectName: "my-app",
        entry: "src/single-spa-index.tsx", //defaults to src/index.js,
        orgPackagesAsExternal: false, // defaults to false. marks packages that has @my-org prefix as external so they are not included in the bundle
        reactPackagesAsExternal: true, // defaults to true. marks react and react-dom as external so they are not included in the bundle
        externals: ["react-router","react-router-dom"], // defaults to []. marks the specified modules as external so they are not included in the bundle
        minimize: false // defaults to false, sets optimization.minimize value
      },
    }]
}
  1. Update the scripts section of your package.json as follows:
  ...
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "craco:build": "craco build",
    "craco:start": "craco start",
    ...
  1. Run npm run craco:build to generate your microfrontend app bundle. The output will be located under build folder and named as my-org-my-app.js

License

Licensed under the MIT License, Copyright Šī¸ 2021 Hasan Ayan. See LICENSE.md for more information.

craco-plugin-single-spa-application's People

Contributors

hasanayan avatar tomyail avatar

Watchers

James Cloos avatar

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.