module-federation / external-remotes-plugin

Dynamically set remote origins at runtime within hosts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use this plugin in rspack?

PIMBA opened this issue · comments

How to use this plugin in rspack?

Were you able to solve this?

We're getting this error:

ERROR in × TypeError: Cannot read properties of undefined (reading 'tap')
  │

image

There is another plugin for dynamic remotes that works with rspack.

import { importRemote } from "@module-federation/utilities";

const ShellService = 
  React.lazy(() =>
    importRemote({
      scope: "shell",
      module: "./ShellService",
      remoteEntryFileName: "remoteEntry.js",
      url: () => axios.get("/remotes").then(data => data.shellRemoteURL), // e.g. http://localhost:3000
    })
  )
);