Skip to content

Commit 0daf1af

Browse files
committed
baseline
0 parents  commit 0daf1af

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+15530
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Microfrontends using Next.js and Module Federation
2+
3+
Microfrontends using Next.js and Module Federation

micro-front-end-activate/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env.local
29+
.env.development.local
30+
.env.test.local
31+
.env.production.local
32+
33+
# vercel
34+
.vercel

micro-front-end-activate/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/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+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18+
19+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20+
21+
## Learn More
22+
23+
To learn more about Next.js, take a look at the following resources:
24+
25+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27+
28+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29+
30+
## Deploy on Vercel
31+
32+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33+
34+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
import Image from 'next/image'
3+
import styles from '../styles/Mario.module.css'
4+
5+
const Mario = () => {
6+
return (
7+
<main className={styles.main}>
8+
<Image
9+
src="https://upload.wikimedia.org/wikipedia/en/a/a9/MarioNSMBUDeluxe.png"
10+
alt="Mario"
11+
width={240}
12+
height={413}
13+
/>
14+
<h1 className={styles.title}>
15+
G'day! I'm Mario, a microfrontend.
16+
</h1>
17+
<span>I'm hosted at <a target="_blank" href="https://mf-micro-front-end-activate.vercel.app">https://mf-micro-front-end-activate.vercel.app</a></span>
18+
</main>
19+
)
20+
}
21+
22+
export default Mario
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const {
2+
withModuleFederation,
3+
} = require("@module-federation/nextjs-mf");
4+
module.exports = {
5+
future: { webpack5: true },
6+
images: {
7+
domains: ['upload.wikimedia.org'],
8+
},
9+
webpack: (config, options) => {
10+
const { isServer } = options;
11+
const mfConf = {
12+
mergeRuntime: true, //experimental
13+
name: "app2",
14+
library: {
15+
type: config.output.libraryTarget,
16+
name: "app2",
17+
},
18+
filename: "static/runtime/app2remoteEntry.js",
19+
remotes: {
20+
},
21+
exposes: {
22+
"./mario": "./components/mario",
23+
},
24+
};
25+
config.cache = false;
26+
withModuleFederation(config, options, mfConf);
27+
28+
return config;
29+
},
30+
31+
webpackDevMiddleware: (config) => {
32+
// Perform customizations to webpack dev middleware config
33+
// Important: return the modified config
34+
return config;
35+
},
36+
};

0 commit comments

Comments
 (0)