Skip to content

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

Merged
ScriptedAlchemy merged 7 commits into
module-federation:masterfrom
benmarch:add-nextjs-ssr-manifest
Jun 23, 2026
Merged

feat(nextjs-mf): added nextjs-ssr-manifest example#4231
ScriptedAlchemy merged 7 commits into
module-federation:masterfrom
benmarch:add-nextjs-ssr-manifest

Conversation

@benmarch

@benmarch benmarch commented Jul 7, 2024

Copy link
Copy Markdown
Contributor

This is a clone of the nextjs-ssr example, but it uses mf-manifest.json instead of remoteEntry.js. Requires changes from this PR: module-federation/core#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: '*',
          },
        ],
      }
    ]
  },
  //...
}

@CLAassistant

CLAassistant commented Jul 7, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Jul 7, 2024

Copy link
Copy Markdown

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 github-actions Bot added the workflow-failure Workflow is failed label Jul 7, 2024
@ScriptedAlchemy

Copy link
Copy Markdown
Member

Current blockers: this draft PR is conflicting and stale. The Next.js SSR manifest idea may still be useful, but it should be rebased/modernized against current master only if the demo is still wanted; keep the README's server-code exposure warning and avoid broad dependency churn.

@ScriptedAlchemy ScriptedAlchemy marked this pull request as ready for review June 23, 2026 17:23
@ScriptedAlchemy ScriptedAlchemy force-pushed the add-nextjs-ssr-manifest branch from d0c22d9 to 7298c96 Compare June 23, 2026 17:25
for (const folder of folders) {
describe(`${folder}`, () => {
const apps = getFiles(resolve(__dirname, '..', folder));
for (app of apps) {
@@ -0,0 +1,27 @@
import { Suspense, lazy } from 'react';
import App from 'next/app';
import dynamic from 'next/dynamic';
@@ -0,0 +1,65 @@
import React, { Suspense, lazy } from 'react';
import Link from 'next/link';
import dynamic from 'next/dynamic';
@@ -0,0 +1,103 @@
import React, { Fragment, Suspense, lazy } from 'react';
@@ -0,0 +1,103 @@
import React, { Fragment, Suspense, lazy } from 'react';
import Head from 'next/head';
import dynamic from 'next/dynamic';
@@ -0,0 +1,21 @@
import { Suspense, lazy } from 'react';
import App from 'next/app';
import dynamic from 'next/dynamic';

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0c22d9c6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread nextjs-ssr-manifest/e2e/checkApps.cy.ts Outdated
Comment on lines +1 to +3
import { BaseMethods } from '../../cypress-e2e/common/base';
import { baseSelectors, selectors } from '../../cypress-e2e/common/selectors';
import { Constants } from '../../cypress-e2e/fixtures/constants';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the missing E2E helper imports

These imports point at ../../cypress-e2e, but a repo-wide search in this checkout finds no cypress-e2e directory (only the existing playwright-e2e helpers). Whenever the new e2e:ci script tries to compile this Cypress spec, module resolution fails before any of the manifest example is exercised, so either the shared Cypress helpers/config need to be added or the spec should use the existing Playwright test infrastructure.

Useful? React with 👍 / 👎.

@@ -0,0 +1,25 @@
{
"name": "nextjs-ssr-manifest",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Register the example in the root workspace

This new package is not matched by the root pnpm-workspace.yaml (I checked the existing workspace entries around nextjs-ssr, and there is no nextjs-ssr-manifest entry). pnpm install --help says that installs run inside a workspace install dependencies for all workspace projects, but pnpm list --filter 'nextjs-ssr-manifest_*' --only-projects from the repo root returns no projects, so a normal root install or changed-package CI run will skip installing and testing this example; add nextjs-ssr-manifest and nextjs-ssr-manifest/* to the root workspace.

Useful? React with 👍 / 👎.

@ScriptedAlchemy ScriptedAlchemy merged commit 583a155 into module-federation:master Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workflow-failure Workflow is failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants