Nextjs+ Turborepo+ @module-federation/nextjs-mf: Error: Cannot find module ../lib/util/makeSerializable'

186 Views Asked by At

i have that problem when run pnpm dev
enter image description here

that project i trust init it, but i have that error so thanh you any for help

loremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremloremlorem

help me fix that error

module.exports = {
  transpilePackages: ["@repo/ui"],
  webpack(config, options) {
    const { isServer } = options;
    config.experiments = { topLevelAwait: true };
    config.plugins.push(
      new NextFederationPlugin({
        name: "remote_nextjs_module",
        filename: "static/chunks/remoteEntry.js",
        remotes: {
          // next1: `next1@http://localhost:3001/_next/static/${
          //   isServer ? "ssr" : "chunks"
          // }/remoteEntry.js`,
          host_react_module: "remoteEntry.js",
          // remoteApp: `internal ${require.resolve(
          //   "./relative/path/to/delegate-module.js"
          // )}?remote=remoteApp@http://localhost:3001/_next/static/${
          //   isServer ? "ssr" : "chunks"
          // }/remoteEntry.js`,
        },
        exposes: {
          "./oki": "./src/text.tsx",
          // './test2': './src/test.tsx',
        },
        shared: {
          react: {
            eager: true,
            // singleton: true,
            // requiredVersion: "18.2.0",
          },
          "react-dom": {
            eager: true,
            // singleton: true,
            // requiredVersion: "18.2.0",
          },
        },
        extraOptions: {
          automaticAsyncBoundary: true,
        },
      })
    );

    return config;
  },
};
1

There are 1 best solutions below

0
Javier Orsaria On

Try setting env variable NEXT_PRIVATE_LOCAL_WEBPACK in command line:

"NEXT_PRIVATE_LOCAL_WEBPACK=true next dev"