single-spa / standalone-single-spa-webpack-plugin

A webpack plugin for running microfrontends in standalone mode.
MIT License
41 stars 7 forks source link

standaloneOptions customProps not working for standalone app. #24

Open DamianPereira opened 1 year ago

DamianPereira commented 1 year ago

Hi! I have this configuration in my webpack.config.js, these are 2 new root and microfrontend app created with create-single-spa 4.1.2

  const defaultConfig = singleSpaDefaults({
    orgName: "someOrg",
    projectName: "mf1",
    webpackConfigEnv,
    argv,
    standaloneOptions: {
      customProps: {
        testing: true,
      },
    },
  });

And this in my main app js file

const lifecycles = singleSpaReact({
  React,
  ReactDOM,
  loadRootComponent: (args) => {
    console.log(args.testing);
      return Promise.resolve(Root);
    }
  },
  errorBoundary(err, info, props) {
    // Customize the root error boundary for your microfrontend here.
    return null;
  },
});

The testing customProp does not reach the args inside loadRootComponent when using the standalone mode. But if I do this in root-config for embedded mode, then it works:

registerApplication({
  name: "someOrg/mf1",
  app: () => System.import("someOrg/mf1"),
  activeWhen: ["/"],
  customProps: {
    testing: true
  },
});

How can I send custom props to the standAlone app only?