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

[email protected] @module-federation/[email protected] error #4344

Open
Capricair opened this issue Mar 27, 2025 · 10 comments
Open

[email protected] @module-federation/[email protected] error #4344

Capricair opened this issue Mar 27, 2025 · 10 comments

Comments

@Capricair
Copy link

Capricair commented Mar 27, 2025

"dependencies": {
  "@module-federation/nextjs-mf": "8.8.21",
  "@module-federation/runtime": "0.11.2",
  "axios": "1.7.7",
  "next": "12.3.1",
  "prop-types": "15.8.1",
  "react": "17.0.2",
  "react-dom": "17.0.2"
}
// next.config.js
const NextFederationPlugin = require("@module-federation/nextjs-mf");

module.exports = {
  reactStrictMode: true,
  poweredByHeader: false,
  webpack: (config, options) => {
    config.plugins.push(
      new NextFederationPlugin({
        name: "federation",
        filename: "static/chunks/remoteEntry.js",
        exposes: {
          "./test": "./components/test/index.js",
        },
        // remotes: remotes(options.isServer),
        // shared: {},
        // extraOptions: {
        //   exposePages: true,
        // },
      })
    );
    return config;
  },
};

npm run dev

Image

webpack-internal:///node_modules/@module-federation/sdk/dist/index.cjs.js

Image

npm run build

Image

@Capricair
Copy link
Author

@ScriptedAlchemy Hello, can you help me?

@ScriptedAlchemy
Copy link
Member

Repo?

@Capricair
Copy link
Author

Repo?

https://stackblitz.com/edit/stackblitz-starters-dbm25yxu?file=next.config.js

@ScriptedAlchemy Here is the code, I commented out the module federation plugin, remove comment and run npm run dev

@ScriptedAlchemy
Copy link
Member

example does not run - provide a actual repo i can clone onto my computer

@Capricair
Copy link
Author

example does not run - provide a actual repo i can clone onto my computer

@ScriptedAlchemy https://github.com/Capricair/next-ssr-mf/tree/master

@ScriptedAlchemy
Copy link
Member

Much love, ill take a look - however next 12 is very old and may be that characteristics in the build are different vs in newer versions like next 14

@ScriptedAlchemy
Copy link
Member

use "@module-federation/nextjs-mf": "8.6.0" - this version seems to work.

@Capricair
Copy link
Author

Much love, ill take a look - however next 12 is very old and may be that characteristics in the build are different vs in newer versions like next 14

Next12 is realy old, but we have a big app still use next12, it is a very important app to us.

@ScriptedAlchemy
Copy link
Member

8.6.0 is last working version. I'm not sure why it stops working beyond that but you can pin there for time being

@Capricair
Copy link
Author

@ScriptedAlchemy Thank you very much!

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