Dynamic Import Path on Server Side using Module Federation #581
Unanswered
prashantns9
asked this question in
Q&A
Replies: 1 comment
-
As far as I know, imports must be string literal and not variables because webpack needs to know them at build time. If you want to dynamically import modules, this example can help: https://github.com/module-federation/module-federation-examples/tree/master/advanced-api/dynamic-remotes |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to import a function from a remote project which exposes this function using UniversalFederationPlugin and then invoke it in another project. This only works when I provide a static path to the import() function for example -
However I want to compute this path at runtime for example -
this does not work and I get below error
Error: Cannot find module 'remoteLib/businessInfo'
You find find complete code here - https://github.com/prashantns9/server-side-module-federation-example/blob/master/platform/src/index.js#L9
Is there any way to compute the import path at runtime?
Beta Was this translation helpful? Give feedback.
All reactions