Skip to content

federated store example fails #3536

Description

@wibed

based on my recent comment here:
#2042

i tried to proof my theory, yet fail to do so. now i am asking myself if i have made a mistake elsewhere:
https://github.com/wibed/mf-example_federated-store

in short:
i try to avoid an approach like this

const dynamicFederation = async (scope, module) => {
  const container = window[scope];

  // or get the container somewhere else
  // Initialize the container, it may provide shared modules
  await container.init(__webpack_share_scopes__.default);
  return container.get(module).then(factory => {
    const Module = factory();
    return Module;
  });
};

and rather use

...
// server
    exposes: {
      './store': './src/client/store',
    },
...
// client
    exposes: {
      './App': './src/bootstrap',
    },    
...

i tried using the file extension as well /src/bootstrap.tsx, but it fails to load. even passing an empty object in case the store not loading in time causes some issue.

EDIT: i try not to change the store in any way. just passing it down the tree to see if i can implement stateful applications remotely. later on i would like to inject reducers as in the example
https://github.com/module-federation/module-federation-examples/tree/master/redux-reducer-injection

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions