module-federation / external-remotes-plugin

Dynamically set remote origins at runtime within hosts
MIT License
52 stars 9 forks source link

How to use this plugin in rspack? #9

Open PIMBA opened 11 months ago

sherbakovdev commented 9 months ago

Were you able to solve this?

steven-pribilinskiy commented 9 months ago

We're getting this error:

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

image

sherbakovdev commented 9 months ago

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
    })
  )
);
86XIng commented 1 month ago

Wrote a plugin for that. https://www.npmjs.com/package/runtime-external-remotes-plugin