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

feat(nextjs-mf): added nextjs-ssr-manifest example

Open benmarch opened this issue 1 year ago • 2 comments

This is a clone of the nextjs-ssr example, but it uses mf-manifest.json instead of remoteEntry.js. Requires changes from this PR: https://github.com/module-federation/core/pull/2726

This requires some CORS config to allow the manifest to be fetched from the browser. I just added the following to the NextJS config in each app, but there are other ways to do it:

// next.config.js

module.exports = {
  headers() {
    return [
      {
        source: '/_next/static/chunks/mf-manifest.json',
        headers: [
          {
            key: 'Access-Control-Allow-Origin',
            value: '*',
          },
        ],
      }
    ]
  },
  //...
}

benmarch avatar Jul 07 '24 20:07 benmarch

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 07 '24 20:07 CLAassistant

Workflow status is failure ❌ Unfortunately test report wasn't generated, it can be if no workspaces changed. Please check the workflow run below. Link to GitHub workflow: Github Workflow Link

github-actions[bot] avatar Jul 07 '24 20:07 github-actions[bot]