react-module-federation icon indicating copy to clipboard operation
react-module-federation copied to clipboard

Support for External Template Remotes Plugin

Open mcarlotta opened this issue 2 years ago • 0 comments

This is more of a support question / feature enhancement than a Issue

With this utilizing withModuleFederation, I noticed endpoints need to be hardcoded. For my use case, utilizing External Template Remotes Plugin for versioning is required. Simply updating the endpoint via remote config is more desirable than having to hardcode the endpoint in webpack and having to re-deploy the application each time. This results in more fragility and longer deployment times.

Is there a way to invoke this plugin?

Tried doing a custom webpack build which sort of works with the dynamic remotes but it seems to not do much of anything else which comes along with the withModuleFederation method such as properly chunking, etc

example:

module.exports = (config, context) => merge(config, {
    module: {
      rules: [
        {
          test: /\.svg$/i,
          issuer: /\.[jt]sx?$/,
          use: ['@svgr/webpack'],
        },
      ],
    },
    plugins: [
      new ModuleFederationPlugin({
        name: 'host-client',
        filename: 'remoteEntry.js',
        remotes: {
          header: 'header@[mfeHeaderRemoteUrl]/remoteEntry.js',
          mpi: 'mpi@[mfeMpiRemoteUrl]/remoteEntry.js',
          wiseboard: 'wiseboard@[mfeWiseboardRemoteUrl]/remoteEntry.js',
        },
      }),
      new ExternalTemplateRemotesPlugin(),
    ],
  })

mcarlotta avatar May 18 '22 16:05 mcarlotta