├── .gitignore
├── home
├── public
│ ├── favicon.ico
│ └── zeit.svg
├── components
│ └── Header.jsx
├── package.json
├── .gitignore
├── pages
│ ├── _document.js
│ └── index.js
├── next.config.js
└── README.md
└── pdp
├── public
├── favicon.ico
└── zeit.svg
├── package.json
├── .gitignore
├── pages
├── _document.js
└── index.js
├── next.config.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | out
3 |
--------------------------------------------------------------------------------
/home/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jherr/wp5-nextjs-10/HEAD/home/public/favicon.ico
--------------------------------------------------------------------------------
/pdp/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jherr/wp5-nextjs-10/HEAD/pdp/public/favicon.ico
--------------------------------------------------------------------------------
/home/components/Header.jsx:
--------------------------------------------------------------------------------
1 | const Header = () => (
2 |
10 |
Header
11 |
12 | );
13 |
14 | export default Header;
15 |
--------------------------------------------------------------------------------
/home/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "home",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start"
9 | },
10 | "resolutions": {
11 | "webpack": "5.1.3",
12 | "next": "9.5.5"
13 | },
14 | "dependencies": {
15 | "@module-federation/nextjs-mf": "0.0.1-beta.4",
16 | "next": "^9.5.6-canary.0",
17 | "react": "17.0.1",
18 | "react-dom": "17.0.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/pdp/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pdp",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev -p 3001",
7 | "build": "next build",
8 | "start": "next start"
9 | },
10 | "resolutions": {
11 | "webpack": "5.1.3",
12 | "next": "9.5.5"
13 | },
14 | "dependencies": {
15 | "@module-federation/nextjs-mf": "0.0.1-beta.4",
16 | "next": "^9.5.6-canary.0",
17 | "react": "17.0.1",
18 | "react-dom": "17.0.1"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/home/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 |
21 | # debug
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # local env files
27 | .env.local
28 | .env.development.local
29 | .env.test.local
30 | .env.production.local
31 |
--------------------------------------------------------------------------------
/pdp/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 |
21 | # debug
22 | npm-debug.log*
23 | yarn-debug.log*
24 | yarn-error.log*
25 |
26 | # local env files
27 | .env.local
28 | .env.development.local
29 | .env.test.local
30 | .env.production.local
31 |
--------------------------------------------------------------------------------
/home/pages/_document.js:
--------------------------------------------------------------------------------
1 | import Document, { Html, Head, Main, NextScript } from "next/document";
2 | import { patchSharing } from "@module-federation/nextjs-mf";
3 |
4 | class MyDocument extends Document {
5 | static async getInitialProps(ctx) {
6 | const initialProps = await Document.getInitialProps(ctx);
7 | return { ...initialProps };
8 | }
9 |
10 | render() {
11 | return (
12 |
13 | {patchSharing()}
14 |
16 |
17 |
18 |
19 |
20 | );
21 | }
22 | }
23 |
24 | export default MyDocument;
25 |
--------------------------------------------------------------------------------
/pdp/pages/_document.js:
--------------------------------------------------------------------------------
1 | import Document, { Html, Head, Main, NextScript } from "next/document";
2 | import { patchSharing } from "@module-federation/nextjs-mf";
3 |
4 | class MyDocument extends Document {
5 | static async getInitialProps(ctx) {
6 | const initialProps = await Document.getInitialProps(ctx);
7 | return { ...initialProps };
8 | }
9 |
10 | render() {
11 | return (
12 |
13 | {patchSharing()}
14 |
15 |
17 |
18 |
19 |
20 |
21 | );
22 | }
23 | }
24 |
25 | export default MyDocument;
26 |
--------------------------------------------------------------------------------
/home/public/zeit.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/pdp/public/zeit.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/home/next.config.js:
--------------------------------------------------------------------------------
1 | const {
2 | withModuleFederation,
3 | MergeRuntime,
4 | } = require("@module-federation/nextjs-mf");
5 | const path = require("path");
6 |
7 | module.exports = {
8 | webpack: (config, options) => {
9 | const { buildId, dev, isServer, defaultLoaders, webpack } = options;
10 | const mfConf = {
11 | name: "home",
12 | library: { type: config.output.libraryTarget, name: "home" },
13 | filename: "static/runtime/remoteEntry.js",
14 | remotes: {},
15 | exposes: {
16 | "./Header": "./components/Header",
17 | },
18 | shared: [],
19 | };
20 |
21 | // Configures ModuleFederation and other Webpack properties
22 | withModuleFederation(config, options, mfConf);
23 |
24 | config.plugins.push(new MergeRuntime());
25 |
26 | if (!isServer) {
27 | config.output.publicPath = "http://localhost:3000/_next/";
28 | }
29 |
30 | return config;
31 | },
32 | };
33 |
--------------------------------------------------------------------------------
/pdp/next.config.js:
--------------------------------------------------------------------------------
1 | const {
2 | withModuleFederation,
3 | MergeRuntime,
4 | } = require("@module-federation/nextjs-mf");
5 | const path = require("path");
6 |
7 | module.exports = {
8 | webpack: (config, options) => {
9 | const { buildId, dev, isServer, defaultLoaders, webpack } = options;
10 | const mfConf = {
11 | name: "pdp",
12 | library: { type: config.output.libraryTarget, name: "pdp" },
13 | filename: "static/runtime/remoteEntry.js",
14 | remotes: {
15 | // For SSR, resolve to disk path (or you can use code streaming if you have access)
16 | home: isServer
17 | ? path.resolve(
18 | __dirname,
19 | "../home/.next/server/static/runtime/remoteEntry.js"
20 | )
21 | : "home", // for client, treat it as a global
22 | },
23 | exposes: {},
24 | shared: [],
25 | };
26 |
27 | // Configures ModuleFederation and other Webpack properties
28 | withModuleFederation(config, options, mfConf);
29 |
30 | if (!isServer) {
31 | config.output.publicPath = "http://localhost:3001/_next/";
32 | }
33 |
34 | config.plugins.push(new MergeRuntime());
35 |
36 | return config;
37 | },
38 | };
39 |
--------------------------------------------------------------------------------
/home/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | ```
12 |
13 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14 |
15 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16 |
17 | ## Learn More
18 |
19 | To learn more about Next.js, take a look at the following resources:
20 |
21 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
22 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
23 |
24 | You can check out [the Next.js GitHub repository](https://github.com/zeit/next.js/) - your feedback and contributions are welcome!
25 |
26 | ## Deploy on ZEIT Now
27 |
28 | The easiest way to deploy your Next.js app is to use the [ZEIT Now Platform](https://zeit.co/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
29 |
30 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31 |
--------------------------------------------------------------------------------
/pdp/README.md:
--------------------------------------------------------------------------------
1 | This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app).
2 |
3 | ## Getting Started
4 |
5 | First, run the development server:
6 |
7 | ```bash
8 | npm run dev
9 | # or
10 | yarn dev
11 | ```
12 |
13 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14 |
15 | You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16 |
17 | ## Learn More
18 |
19 | To learn more about Next.js, take a look at the following resources:
20 |
21 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
22 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
23 |
24 | You can check out [the Next.js GitHub repository](https://github.com/zeit/next.js/) - your feedback and contributions are welcome!
25 |
26 | ## Deploy on ZEIT Now
27 |
28 | The easiest way to deploy your Next.js app is to use the [ZEIT Now Platform](https://zeit.co/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
29 |
30 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
31 |
--------------------------------------------------------------------------------
/home/pages/index.js:
--------------------------------------------------------------------------------
1 | import Head from "next/head";
2 |
3 | import Header from "../components/Header.jsx";
4 |
5 | const Home = () => (
6 |
7 |
8 |
Create Next App
9 |
10 |
11 |
12 |
13 |
14 |
15 | Welcome to Next.js!
16 |
17 |
18 |
19 | Get started by editing pages/index.js
20 |
21 |
22 |
51 |
52 |
53 |
62 |
63 |
189 |
190 |
203 |
204 | );
205 |
206 | export default Home;
207 |
--------------------------------------------------------------------------------
/pdp/pages/index.js:
--------------------------------------------------------------------------------
1 | import Head from "next/head";
2 |
3 | const Header = (await import("home/Header")).default;
4 |
5 | const Home = () => (
6 |
7 |
8 |
Create Next App
9 |
10 |
11 |
12 |
13 |
14 |
15 | Welcome to Next.js!
16 |
17 |
18 |
19 | Get started by editing pages/index.js
20 |
21 |
22 |
51 |
52 |
53 |
62 |
63 |
189 |
190 |
203 |
204 | );
205 |
206 | export default Home;
207 |
--------------------------------------------------------------------------------