GithubHelp home page GithubHelp logo

hasanayan / craco-module-federation Goto Github PK

View Code? Open in Web Editor NEW
51.0 51.0 19.0 741 KB

Enable Module Federation on your CRA project without ejecting or losing update support of react-scripts

License: MIT License

HTML 34.73% JavaScript 32.34% Shell 0.09% CSS 9.38% TypeScript 22.51% SCSS 0.95%

craco-module-federation's Introduction

craco-module-federation's People

Contributors

hasanayan 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

Watchers

 avatar  avatar  avatar  avatar

craco-module-federation's Issues

cannot update publicPath in remoteEntry.js

I use create-react-app and craco to use webpack 5 module federation

"react-scripts": "5.0.0-next.47",
"@craco/craco": "^6.4.0",
"craco-module-federation": "^1.1.0",

I want to know why set publicPath to 'auto' in code

At my project,I edit publicPath by craco.config.js like

module.exports = {
  webpack: {
    configure: (webpackConfig, { env, paths }) => {
      webpackConfig.output = {
        ...webpackConfig.output,
        publicPath: "https://abc.com",
      };
      return webpackConfig;
    },
  },
...

and run yarn build-->"build": "craco build", but it not works.

when I update it to "build": "PUBLIC_URL=https://abv.com craco build",it only works in index.html, not work in remoteEntry.js

How can resolve "ChunkLoadError: Loading chunk" with your plugin?

My case I have an react app using CRACO without your craco-module-federation plugin, so my craco.config file looks like:

craco.config

const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const deps = require("./package.json").dependencies;

module.exports = {
  devServer: {
    port: 5004
  },
  webpack: {
    plugins: [
      new ModuleFederationPlugin({
        name: "reactappcraco",
        filename: "remoteEntry.js",
        exposes: {
          "./web-components": "./src/index.js",
        },
        shared: {
          ...deps,
          react: {
            singleton: true,
            requiredVersion: deps.react,
          },
          "react-dom": {
            singleton: true,
            requiredVersion: deps["react-dom"],
          },
        },
      })
    ],
  }
}

But, when execute the app in the browser console shows:

Screen Shot 2022-04-27 at 12 30 38 PM

However, when I use your plugin this error does not show, I can see that you are using in your plugin the overrideWebpackConfig function, I would like to know why don't show you the ChunkError?.

maybe could be for this

Screen Shot 2022-04-27 at 12 38 14 PM

sorry this is not an issue, it is like a question.. ty.. :)

[IE11] Automatic publicPath is not supported in this browser

Checked my app in IE11 and got Automatic publicPath is not supported in this browser
Also, didn't find a way to rewrite this line, looks that craco runs plugins after webpack.configure
Tried different options from official docs but get this exception earlier than a workaround is executed

Please suggest a way to avoid the error

"@craco/craco": "^6.4.0"
"craco-module-federation": "^1.1.0"
"react-scripts": "^5.0.0"
Win10
IE 11.379.17763.0

Screen Shot 2022-01-11 at 4 59 44 pm

Production ready version availability

We are exploring the possibilities of micro-frontend UIs and require to use Webpack 5 module federation feature and the Module Federation Plugin to achieve this. Came across this plugin when reading on Module Federation with Create React App - can you tell us when is this going to be ready for production use now that react-scripts has launched 5.0.0 officially?

Error on yarn start

Hey thank you for this project :)

I have a remote app with a craco.config.js including a

plugins: [
    {
      plugin: CracoModuleFederation,
    },
    {

and when I am creating a modulefederation.config.js

const packageJson = require("./package.json")

module.exports = {
  name: "BusinessPartnerInterface",
  filename: "remoteEntry.js",
  exposes: {
    "./BusinessPartnerInterface": "./src/bootstrap",
  },
  shared: packageJson.dependencies,
}

to add the options I am getting an error, when doing yarn start.

Failed to compile.

Cannot read properties of undefined (reading 'includes')

error Command failed with exit code 1.

Doesn't matter if the modulefederation config file is empty or not.

Any idea what's wrong here?

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.