diff --git a/nested/README.md b/nested-remote/README.md similarity index 100% rename from nested/README.md rename to nested-remote/README.md diff --git a/nested/app1/package.json b/nested-remote/app1/package.json similarity index 100% rename from nested/app1/package.json rename to nested-remote/app1/package.json diff --git a/nested/app1/public/index.html b/nested-remote/app1/public/index.html similarity index 100% rename from nested/app1/public/index.html rename to nested-remote/app1/public/index.html diff --git a/nested/app1/src/App.js b/nested-remote/app1/src/App.js similarity index 100% rename from nested/app1/src/App.js rename to nested-remote/app1/src/App.js diff --git a/nested/app1/src/bootstrap.js b/nested-remote/app1/src/bootstrap.js similarity index 100% rename from nested/app1/src/bootstrap.js rename to nested-remote/app1/src/bootstrap.js diff --git a/nested/app1/src/index.js b/nested-remote/app1/src/index.js similarity index 100% rename from nested/app1/src/index.js rename to nested-remote/app1/src/index.js diff --git a/nested/app1/webpack.config.js b/nested-remote/app1/webpack.config.js similarity index 100% rename from nested/app1/webpack.config.js rename to nested-remote/app1/webpack.config.js diff --git a/nested/app2/package.json b/nested-remote/app2/package.json similarity index 100% rename from nested/app2/package.json rename to nested-remote/app2/package.json diff --git a/nested/app2/public/index.html b/nested-remote/app2/public/index.html similarity index 100% rename from nested/app2/public/index.html rename to nested-remote/app2/public/index.html diff --git a/nested/app2/src/App.js b/nested-remote/app2/src/App.js similarity index 100% rename from nested/app2/src/App.js rename to nested-remote/app2/src/App.js diff --git a/nested/app2/src/ButtonContainer.js b/nested-remote/app2/src/ButtonContainer.js similarity index 100% rename from nested/app2/src/ButtonContainer.js rename to nested-remote/app2/src/ButtonContainer.js diff --git a/nested/app2/src/bootstrap.js b/nested-remote/app2/src/bootstrap.js similarity index 100% rename from nested/app2/src/bootstrap.js rename to nested-remote/app2/src/bootstrap.js diff --git a/nested/app2/src/index.js b/nested-remote/app2/src/index.js similarity index 100% rename from nested/app2/src/index.js rename to nested-remote/app2/src/index.js diff --git a/nested/app2/webpack.config.js b/nested-remote/app2/webpack.config.js similarity index 100% rename from nested/app2/webpack.config.js rename to nested-remote/app2/webpack.config.js diff --git a/nested/app3/package.json b/nested-remote/app3/package.json similarity index 100% rename from nested/app3/package.json rename to nested-remote/app3/package.json diff --git a/nested/app3/public/index.html b/nested-remote/app3/public/index.html similarity index 100% rename from nested/app3/public/index.html rename to nested-remote/app3/public/index.html diff --git a/nested/app3/src/App.js b/nested-remote/app3/src/App.js similarity index 100% rename from nested/app3/src/App.js rename to nested-remote/app3/src/App.js diff --git a/nested/app3/src/Button.js b/nested-remote/app3/src/Button.js similarity index 100% rename from nested/app3/src/Button.js rename to nested-remote/app3/src/Button.js diff --git a/nested/app3/src/bootstrap.js b/nested-remote/app3/src/bootstrap.js similarity index 100% rename from nested/app3/src/bootstrap.js rename to nested-remote/app3/src/bootstrap.js diff --git a/nested/app3/src/index.js b/nested-remote/app3/src/index.js similarity index 100% rename from nested/app3/src/index.js rename to nested-remote/app3/src/index.js diff --git a/nested/app3/webpack.config.js b/nested-remote/app3/webpack.config.js similarity index 100% rename from nested/app3/webpack.config.js rename to nested-remote/app3/webpack.config.js diff --git a/nested/cypress.env.json b/nested-remote/cypress.env.json similarity index 100% rename from nested/cypress.env.json rename to nested-remote/cypress.env.json diff --git a/nested/e2e/checkApp1.cy.ts b/nested-remote/e2e/checkApp1.cy.ts similarity index 100% rename from nested/e2e/checkApp1.cy.ts rename to nested-remote/e2e/checkApp1.cy.ts diff --git a/nested/e2e/checkApp2.cy.ts b/nested-remote/e2e/checkApp2.cy.ts similarity index 100% rename from nested/e2e/checkApp2.cy.ts rename to nested-remote/e2e/checkApp2.cy.ts diff --git a/nested/e2e/checkApp3.cy.ts b/nested-remote/e2e/checkApp3.cy.ts similarity index 100% rename from nested/e2e/checkApp3.cy.ts rename to nested-remote/e2e/checkApp3.cy.ts diff --git a/nested/e2e/runAll.cy.ts b/nested-remote/e2e/runAll.cy.ts similarity index 100% rename from nested/e2e/runAll.cy.ts rename to nested-remote/e2e/runAll.cy.ts diff --git a/nested/package.json b/nested-remote/package.json similarity index 96% rename from nested/package.json rename to nested-remote/package.json index 95d0f48aa23..2b50c704d9e 100644 --- a/nested/package.json +++ b/nested-remote/package.json @@ -1,5 +1,5 @@ { - "name": "nested", + "name": "nested-remotes", "description": "Demonstration of loading nested remote components: 'app1' (host) async loads 'ButtonContainer' from 'app2', which in turn async loads 'Button' from 'app3'.", "private": true, "version": "0.0.0", diff --git a/nested/sandbox.config.json b/nested-remote/sandbox.config.json similarity index 100% rename from nested/sandbox.config.json rename to nested-remote/sandbox.config.json diff --git a/nextjs-v14/README.md b/nextjs-csr/README.md similarity index 97% rename from nextjs-v14/README.md rename to nextjs-csr/README.md index df8284e2b8a..ca26c6e38e8 100644 --- a/nextjs-v14/README.md +++ b/nextjs-csr/README.md @@ -1,3 +1,7 @@ +# Support For Next.js is ending + +https://github.com/module-federation/core/issues/3153 + # Next.js 14 with Module Federation Module Federation in Next.js depends on @module-federation/nextjs-mf diff --git a/nextjs-v12/checkout/components/exposedTitle.js b/nextjs-csr/checkout/components/exposedTitle.js similarity index 100% rename from nextjs-v12/checkout/components/exposedTitle.js rename to nextjs-csr/checkout/components/exposedTitle.js diff --git a/nextjs-v13/checkout/next.config.js b/nextjs-csr/checkout/next.config.js similarity index 100% rename from nextjs-v13/checkout/next.config.js rename to nextjs-csr/checkout/next.config.js diff --git a/nextjs-v14/checkout/package.json b/nextjs-csr/checkout/package.json similarity index 100% rename from nextjs-v14/checkout/package.json rename to nextjs-csr/checkout/package.json diff --git a/nextjs-v12/checkout/pages-map.js b/nextjs-csr/checkout/pages-map.js similarity index 100% rename from nextjs-v12/checkout/pages-map.js rename to nextjs-csr/checkout/pages-map.js diff --git a/nextjs-v14/checkout/pages/[...slug].js b/nextjs-csr/checkout/pages/[...slug].js similarity index 100% rename from nextjs-v14/checkout/pages/[...slug].js rename to nextjs-csr/checkout/pages/[...slug].js diff --git a/nextjs-v14/checkout/pages/_app.js b/nextjs-csr/checkout/pages/_app.js similarity index 100% rename from nextjs-v14/checkout/pages/_app.js rename to nextjs-csr/checkout/pages/_app.js diff --git a/nextjs-v13/checkout/pages/_document.js b/nextjs-csr/checkout/pages/_document.js similarity index 100% rename from nextjs-v13/checkout/pages/_document.js rename to nextjs-csr/checkout/pages/_document.js diff --git a/nextjs-v12/checkout/pages/checkout.js b/nextjs-csr/checkout/pages/checkout.js similarity index 100% rename from nextjs-v12/checkout/pages/checkout.js rename to nextjs-csr/checkout/pages/checkout.js diff --git a/nextjs-v14/checkout/pages/index.js b/nextjs-csr/checkout/pages/index.js similarity index 100% rename from nextjs-v14/checkout/pages/index.js rename to nextjs-csr/checkout/pages/index.js diff --git a/nextjs-v12/checkout/pages/shop/mybag.js b/nextjs-csr/checkout/pages/shop/mybag.js similarity index 100% rename from nextjs-v12/checkout/pages/shop/mybag.js rename to nextjs-csr/checkout/pages/shop/mybag.js diff --git a/nextjs-v12/checkout/public/favicon.ico b/nextjs-csr/checkout/public/favicon.ico similarity index 100% rename from nextjs-v12/checkout/public/favicon.ico rename to nextjs-csr/checkout/public/favicon.ico diff --git a/nextjs-react/cypress.env.json b/nextjs-csr/cypress.env.json similarity index 100% rename from nextjs-react/cypress.env.json rename to nextjs-csr/cypress.env.json diff --git a/nextjs-v13/home/components/nav.js b/nextjs-csr/home/components/nav.js similarity index 100% rename from nextjs-v13/home/components/nav.js rename to nextjs-csr/home/components/nav.js diff --git a/nextjs-v13/home/next.config.js b/nextjs-csr/home/next.config.js similarity index 100% rename from nextjs-v13/home/next.config.js rename to nextjs-csr/home/next.config.js diff --git a/nextjs-v14/home/package.json b/nextjs-csr/home/package.json similarity index 100% rename from nextjs-v14/home/package.json rename to nextjs-csr/home/package.json diff --git a/nextjs-v12/home/pages-map.js b/nextjs-csr/home/pages-map.js similarity index 100% rename from nextjs-v12/home/pages-map.js rename to nextjs-csr/home/pages-map.js diff --git a/nextjs-v14/home/pages/[...slug].js b/nextjs-csr/home/pages/[...slug].js similarity index 100% rename from nextjs-v14/home/pages/[...slug].js rename to nextjs-csr/home/pages/[...slug].js diff --git a/nextjs-v13/home/pages/_app.js b/nextjs-csr/home/pages/_app.js similarity index 100% rename from nextjs-v13/home/pages/_app.js rename to nextjs-csr/home/pages/_app.js diff --git a/nextjs-v13/home/pages/_document.js b/nextjs-csr/home/pages/_document.js similarity index 100% rename from nextjs-v13/home/pages/_document.js rename to nextjs-csr/home/pages/_document.js diff --git a/nextjs-v14/home/pages/index.js b/nextjs-csr/home/pages/index.js similarity index 100% rename from nextjs-v14/home/pages/index.js rename to nextjs-csr/home/pages/index.js diff --git a/nextjs-v12/home/public/favicon.ico b/nextjs-csr/home/public/favicon.ico similarity index 100% rename from nextjs-v12/home/public/favicon.ico rename to nextjs-csr/home/public/favicon.ico diff --git a/nextjs-v14/package.json b/nextjs-csr/package.json similarity index 96% rename from nextjs-v14/package.json rename to nextjs-csr/package.json index 8287ed7335f..ab573039e80 100644 --- a/nextjs-v14/package.json +++ b/nextjs-csr/package.json @@ -1,5 +1,5 @@ { - "name": "nextjs-v14", + "name": "nextjs-csr", "private": true, "description": "Next.js 14 Example", "workspaces": [ diff --git a/nextjs-v12/shared/index.d.ts b/nextjs-csr/shared/index.d.ts similarity index 100% rename from nextjs-v12/shared/index.d.ts rename to nextjs-csr/shared/index.d.ts diff --git a/nextjs-v14/shared/index.js b/nextjs-csr/shared/index.js similarity index 100% rename from nextjs-v14/shared/index.js rename to nextjs-csr/shared/index.js diff --git a/nextjs-v14/shared/package.json b/nextjs-csr/shared/package.json similarity index 100% rename from nextjs-v14/shared/package.json rename to nextjs-csr/shared/package.json diff --git a/nextjs-v12/shop/components/exposedTitle.js b/nextjs-csr/shop/components/exposedTitle.js similarity index 100% rename from nextjs-v12/shop/components/exposedTitle.js rename to nextjs-csr/shop/components/exposedTitle.js diff --git a/nextjs-v13/shop/components/nav.js b/nextjs-csr/shop/components/nav.js similarity index 100% rename from nextjs-v13/shop/components/nav.js rename to nextjs-csr/shop/components/nav.js diff --git a/nextjs-v12/shop/components/someHook.js b/nextjs-csr/shop/components/someHook.js similarity index 100% rename from nextjs-v12/shop/components/someHook.js rename to nextjs-csr/shop/components/someHook.js diff --git a/nextjs-v13/shop/next.config.js b/nextjs-csr/shop/next.config.js similarity index 100% rename from nextjs-v13/shop/next.config.js rename to nextjs-csr/shop/next.config.js diff --git a/nextjs-v14/shop/package.json b/nextjs-csr/shop/package.json similarity index 100% rename from nextjs-v14/shop/package.json rename to nextjs-csr/shop/package.json diff --git a/nextjs-v12/shop/pages-map.js b/nextjs-csr/shop/pages-map.js similarity index 100% rename from nextjs-v12/shop/pages-map.js rename to nextjs-csr/shop/pages-map.js diff --git a/nextjs-v14/shop/pages/[...slug].js b/nextjs-csr/shop/pages/[...slug].js similarity index 100% rename from nextjs-v14/shop/pages/[...slug].js rename to nextjs-csr/shop/pages/[...slug].js diff --git a/nextjs-v14/shop/pages/_app.js b/nextjs-csr/shop/pages/_app.js similarity index 100% rename from nextjs-v14/shop/pages/_app.js rename to nextjs-csr/shop/pages/_app.js diff --git a/nextjs-v13/shop/pages/_document.js b/nextjs-csr/shop/pages/_document.js similarity index 100% rename from nextjs-v13/shop/pages/_document.js rename to nextjs-csr/shop/pages/_document.js diff --git a/nextjs-v14/shop/pages/index.js b/nextjs-csr/shop/pages/index.js similarity index 100% rename from nextjs-v14/shop/pages/index.js rename to nextjs-csr/shop/pages/index.js diff --git a/nextjs-v12/shop/pages/p/[...slug].js b/nextjs-csr/shop/pages/p/[...slug].js similarity index 100% rename from nextjs-v12/shop/pages/p/[...slug].js rename to nextjs-csr/shop/pages/p/[...slug].js diff --git a/nextjs-v12/shop/pages/shop.js b/nextjs-csr/shop/pages/shop.js similarity index 100% rename from nextjs-v12/shop/pages/shop.js rename to nextjs-csr/shop/pages/shop.js diff --git a/nextjs-v12/shop/public/favicon.ico b/nextjs-csr/shop/public/favicon.ico similarity index 100% rename from nextjs-v12/shop/public/favicon.ico rename to nextjs-csr/shop/public/favicon.ico diff --git a/nextjs-dynamic-ssr/README.md b/nextjs-dynamic-ssr/README.md index 995dfbad5ad..88d1c9acfe0 100644 --- a/nextjs-dynamic-ssr/README.md +++ b/nextjs-dynamic-ssr/README.md @@ -1,3 +1,7 @@ +# Support For Next.js is ending + +https://github.com/module-federation/core/issues/3153 + # Next.js with Module Federation ## Getting Started diff --git a/nextjs-react/README.md b/nextjs-host-react-remote/README.md similarity index 96% rename from nextjs-react/README.md rename to nextjs-host-react-remote/README.md index b9e77cd6d3f..5ab62b6272e 100644 --- a/nextjs-react/README.md +++ b/nextjs-host-react-remote/README.md @@ -1,3 +1,7 @@ +# Support For Next.js is ending + +https://github.com/module-federation/core/issues/3153 + # Module Federation with NextJS and Client Side React. Module federation in NextJS depends on [@module-federation/nextjs-mf](https://www.npmjs.com/package/@module-federation/nextjs-mf). diff --git a/nextjs-v12/cypress.env.json b/nextjs-host-react-remote/cypress.env.json similarity index 100% rename from nextjs-v12/cypress.env.json rename to nextjs-host-react-remote/cypress.env.json diff --git a/nextjs-react/e2e/checkHostApp.cy.ts b/nextjs-host-react-remote/e2e/checkHostApp.cy.ts similarity index 100% rename from nextjs-react/e2e/checkHostApp.cy.ts rename to nextjs-host-react-remote/e2e/checkHostApp.cy.ts diff --git a/nextjs-react/e2e/checkRemoteApp.cy.ts b/nextjs-host-react-remote/e2e/checkRemoteApp.cy.ts similarity index 100% rename from nextjs-react/e2e/checkRemoteApp.cy.ts rename to nextjs-host-react-remote/e2e/checkRemoteApp.cy.ts diff --git a/nextjs-react/e2e/runAll.cy.ts b/nextjs-host-react-remote/e2e/runAll.cy.ts similarity index 100% rename from nextjs-react/e2e/runAll.cy.ts rename to nextjs-host-react-remote/e2e/runAll.cy.ts diff --git a/nextjs-react/host-app/.eslintrc.json b/nextjs-host-react-remote/host-app/.eslintrc.json similarity index 100% rename from nextjs-react/host-app/.eslintrc.json rename to nextjs-host-react-remote/host-app/.eslintrc.json diff --git a/nextjs-react/host-app/.gitignore b/nextjs-host-react-remote/host-app/.gitignore similarity index 100% rename from nextjs-react/host-app/.gitignore rename to nextjs-host-react-remote/host-app/.gitignore diff --git a/nextjs-react/host-app/README.md b/nextjs-host-react-remote/host-app/README.md similarity index 100% rename from nextjs-react/host-app/README.md rename to nextjs-host-react-remote/host-app/README.md diff --git a/nextjs-react/host-app/components/Button.js b/nextjs-host-react-remote/host-app/components/Button.js similarity index 100% rename from nextjs-react/host-app/components/Button.js rename to nextjs-host-react-remote/host-app/components/Button.js diff --git a/nextjs-react/host-app/next.config.js b/nextjs-host-react-remote/host-app/next.config.js similarity index 100% rename from nextjs-react/host-app/next.config.js rename to nextjs-host-react-remote/host-app/next.config.js diff --git a/nextjs-react/host-app/package.json b/nextjs-host-react-remote/host-app/package.json similarity index 100% rename from nextjs-react/host-app/package.json rename to nextjs-host-react-remote/host-app/package.json diff --git a/nextjs-react/host-app/pages/_app.js b/nextjs-host-react-remote/host-app/pages/_app.js similarity index 100% rename from nextjs-react/host-app/pages/_app.js rename to nextjs-host-react-remote/host-app/pages/_app.js diff --git a/nextjs-react/host-app/pages/_document.js b/nextjs-host-react-remote/host-app/pages/_document.js similarity index 100% rename from nextjs-react/host-app/pages/_document.js rename to nextjs-host-react-remote/host-app/pages/_document.js diff --git a/nextjs-react/host-app/pages/index.js b/nextjs-host-react-remote/host-app/pages/index.js similarity index 100% rename from nextjs-react/host-app/pages/index.js rename to nextjs-host-react-remote/host-app/pages/index.js diff --git a/nextjs-react/host-app/public/favicon.ico b/nextjs-host-react-remote/host-app/public/favicon.ico similarity index 100% rename from nextjs-react/host-app/public/favicon.ico rename to nextjs-host-react-remote/host-app/public/favicon.ico diff --git a/nextjs-react/host-app/public/vercel.svg b/nextjs-host-react-remote/host-app/public/vercel.svg similarity index 100% rename from nextjs-react/host-app/public/vercel.svg rename to nextjs-host-react-remote/host-app/public/vercel.svg diff --git a/nextjs-react/host-app/styles/globals.css b/nextjs-host-react-remote/host-app/styles/globals.css similarity index 100% rename from nextjs-react/host-app/styles/globals.css rename to nextjs-host-react-remote/host-app/styles/globals.css diff --git a/nextjs-react/package.json b/nextjs-host-react-remote/package.json similarity index 95% rename from nextjs-react/package.json rename to nextjs-host-react-remote/package.json index ace8325456c..0ad91604bf3 100644 --- a/nextjs-react/package.json +++ b/nextjs-host-react-remote/package.json @@ -1,5 +1,5 @@ { - "name": "nextjs-react", + "name": "nextjs-host-react-remote", "version": "1.0.0", "description": "Module Federation with NextJS and Client-Side React Remotes", "private": true, diff --git a/nextjs-react/remote-app/.gitignore b/nextjs-host-react-remote/remote-app/.gitignore similarity index 100% rename from nextjs-react/remote-app/.gitignore rename to nextjs-host-react-remote/remote-app/.gitignore diff --git a/nextjs-react/remote-app/package.json b/nextjs-host-react-remote/remote-app/package.json similarity index 100% rename from nextjs-react/remote-app/package.json rename to nextjs-host-react-remote/remote-app/package.json diff --git a/nextjs-react/remote-app/public/index.html b/nextjs-host-react-remote/remote-app/public/index.html similarity index 100% rename from nextjs-react/remote-app/public/index.html rename to nextjs-host-react-remote/remote-app/public/index.html diff --git a/nextjs-react/remote-app/src/App.js b/nextjs-host-react-remote/remote-app/src/App.js similarity index 100% rename from nextjs-react/remote-app/src/App.js rename to nextjs-host-react-remote/remote-app/src/App.js diff --git a/nextjs-react/remote-app/src/Button.js b/nextjs-host-react-remote/remote-app/src/Button.js similarity index 100% rename from nextjs-react/remote-app/src/Button.js rename to nextjs-host-react-remote/remote-app/src/Button.js diff --git a/nextjs-react/remote-app/src/bootstrap.js b/nextjs-host-react-remote/remote-app/src/bootstrap.js similarity index 100% rename from nextjs-react/remote-app/src/bootstrap.js rename to nextjs-host-react-remote/remote-app/src/bootstrap.js diff --git a/nextjs-react/remote-app/src/index.js b/nextjs-host-react-remote/remote-app/src/index.js similarity index 100% rename from nextjs-react/remote-app/src/index.js rename to nextjs-host-react-remote/remote-app/src/index.js diff --git a/nextjs-react/remote-app/webpack.config.js b/nextjs-host-react-remote/remote-app/webpack.config.js similarity index 100% rename from nextjs-react/remote-app/webpack.config.js rename to nextjs-host-react-remote/remote-app/webpack.config.js diff --git a/nextjs-ssr-react-query/.vscode/extensions.json b/nextjs-ssr-react-query/.vscode/extensions.json deleted file mode 100644 index 64553b175b1..00000000000 --- a/nextjs-ssr-react-query/.vscode/extensions.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "recommendations": [ - "nrwl.angular-console", - "esbenp.prettier-vscode", - "firsttris.vscode-jest-runner", - "dbaeumer.vscode-eslint" - ] -} diff --git a/nextjs-ssr-react-query/README.md b/nextjs-ssr-react-query/README.md index 37ad166ac8a..7dc9ed74ac1 100644 --- a/nextjs-ssr-react-query/README.md +++ b/nextjs-ssr-react-query/README.md @@ -1,3 +1,7 @@ +# Support For Next.js is ending + +https://github.com/module-federation/core/issues/3153 + # Module Federation Next.js Data Fetching with Tanstack Query (react-query) This is an advanced example of using Module Federation with Next.js and Tanstack Query (react-query) to use Next.js data fetching strategies. diff --git a/nextjs-ssr/README.md b/nextjs-ssr/README.md index 995dfbad5ad..4dbced2d573 100644 --- a/nextjs-ssr/README.md +++ b/nextjs-ssr/README.md @@ -1,4 +1,8 @@ -# Next.js with Module Federation +# Support For Next.js is ending + +https://github.com/module-federation/core/issues/3153 + +## Next.js with Module Federation ## Getting Started diff --git a/nextjs-v12/README.md b/nextjs-v12/README.md deleted file mode 100644 index abf676d591f..00000000000 --- a/nextjs-v12/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# Next.js 12 with Module Federation - -Module Federation in Next.js depends on @module-federation/nextjs-mf - -NOTE: There seems to be a problem with css-in-js sharing between federated modules. This is likely due to some internal module not being shared as a singleton. PR is welcome - -## Getting Started - -1. run `pnpm run start` and browse to `http://localhost:3001` - -# We are available to consult - -Looking for SSR over `fetch()` or architecture support and designs for module federation and Next.js? - -Contact me zackary.l.jackson@gmail.com or @ScriptedAlchemy on Twitter - -## Context - -We have three next.js applications - -- `checkout` - port 3000 -- `home` - port 3001 -- `shop` - port 3002 - -The applications utilize omnidirectional routing and pages or components are able to be federated between applications like a SPA - -I am using hooks here to ensure multiple copies of react are not loaded into scope on server or client. - -### Sharing - -Next.js does not have an async boundary. Between the entrypoint and the shared code. -Read this for more context: https://github.com/sokra/slides/blob/master/content/ModuleFederationWebpack5.md - -In order for webpack to figure out who shares what, an async boundary is typically needed somewhere before the module is used. -Usually, we can work around async boundaries for things like `react` by specifying the following - -https://medium.com/dev-genius/module-federation-advanced-api-inwebpack-5-0-0-beta-17-71cd4d42e534?source=friends_link&sk=70658eb0bf58dfcc5ce534cb1cd78b1f - -```js -const config = { - shared: { - react: { - eager: true, - singleton: true, - }, - }, -}; -``` - -However, in the case of Next.js - you need to use @module-federation/nextjs-mf - -## Reference Points - -I do have some helpful examples floating around, hopefully these will be of use. - -Next.js specific: - -- https://github.com/module-federation/module-federation-examples/pull/155/ -- https://github.com/module-federation/module-federation-examples/blob/master/nextjs-sidecar/ - -SSR Specific: - -- https://github.com/module-federation/module-federation-examples/tree/master/server-side-rendering - -Useful files in the SSR build. - -- https://github.com/module-federation/module-federation-examples/blob/master/server-side-rendering/website1/build/webpack.config.js/server.base.js -- https://github.com/module-federation/module-federation-examples/blob/master/server-side-rendering/website1/build/webpack.config.js/client.base.js -- Entrypoint - https://github.com/module-federation/module-federation-examples/blob/master/server-side-rendering/website1/server/index.js -- Async import middleware - https://github.com/module-federation/module-federation-examples/blob/master/server-side-rendering/website1/server/server-entry.js - -The async import middleware is where i keep the async boundary, this is also the only point of reference where React is import into scope. - -By doing so, I can ensure that webpack has time to initialize and load anything it might need before attempting to actually require, and render the application. diff --git a/nextjs-v12/checkout/next.config.js b/nextjs-v12/checkout/next.config.js deleted file mode 100644 index aeb94a0964f..00000000000 --- a/nextjs-v12/checkout/next.config.js +++ /dev/null @@ -1,29 +0,0 @@ -const NextFederationPlugin = require('@module-federation/nextjs-mf'); - -module.exports = { - webpack(config, options) { - const { isServer } = options; - config.plugins.push( - new NextFederationPlugin({ - name: 'checkout', - remotes: { - home: `home@http://localhost:3001/_next/static/${ - isServer ? 'ssr' : 'chunks' - }/remoteEntry.js`, - shop: `shop@http://localhost:3002/_next/static/${ - isServer ? 'ssr' : 'chunks' - }/remoteEntry.js`, - }, - filename: 'static/chunks/remoteEntry.js', - exposes: { - './title': './components/exposedTitle.js', - './checkout': './pages/checkout', - './pages-map': './pages-map.js', - }, - shared: {}, - }), - ); - - return config; - }, -}; diff --git a/nextjs-v12/checkout/package.json b/nextjs-v12/checkout/package.json deleted file mode 100644 index ba5ef5014a1..00000000000 --- a/nextjs-v12/checkout/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "checkout-v12", - "version": "0.1.0", - "scripts": { - "dev": "rm -rf .next && NEXT_PRIVATE_LOCAL_WEBPACK=true next dev", - "build": "NEXT_PRIVATE_LOCAL_WEBPACK=true next build", - "start": "next start" - }, - "dependencies": { - "@module-federation/nextjs-mf": "8.6.3", - "next": "12.3.4", - "nextjs-shared-v12": "workspace:*", - "react": "18.3.1", - "react-dom": "18.3.1", - "webpack": "5.95.0" - } -} \ No newline at end of file diff --git a/nextjs-v12/checkout/pages/[...slug].js b/nextjs-v12/checkout/pages/[...slug].js deleted file mode 100644 index 2f499aac8e0..00000000000 --- a/nextjs-v12/checkout/pages/[...slug].js +++ /dev/null @@ -1,3 +0,0 @@ -import { createFederatedCatchAll } from 'nextjs-shared-v12'; - -export default createFederatedCatchAll(); diff --git a/nextjs-v12/checkout/pages/_app.js b/nextjs-v12/checkout/pages/_app.js deleted file mode 100644 index a11985bc154..00000000000 --- a/nextjs-v12/checkout/pages/_app.js +++ /dev/null @@ -1,20 +0,0 @@ -import App from 'next/app'; -import { lazy, Suspense } from 'react'; -const Nav = lazy(() => import('home/nav')); - -function MyApp({ Component, pageProps }) { - return ( - <> - -