Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
danimauro16 opened this issue Apr 27, 2022 · 1 comment
Open

Comments

@danimauro16
Copy link

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.. :)

@fiuzagr
Copy link

fiuzagr commented Dec 27, 2022

@danimauro16 , I had the same problem. Define webpackConfig.output.publicPath = 'auto'; in your remote app.

See an example:

remote app
https://github.com/fiuzagr/acme-repo/blob/cf213e6216b0f330c9a840904e43e3642827b461/sites/home-site/craco.config.js#L7

host app
https://github.com/fiuzagr/acme-repo/blob/cf213e6216b0f330c9a840904e43e3642827b461/sites/root-site/craco.config.js#L11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants