Skip to content

Commit

Permalink
feat(nextjs-mf): support next 15 peer dep (#3111)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy authored Oct 23, 2024
1 parent 1478f50 commit 450aa37
Show file tree
Hide file tree
Showing 12 changed files with 563 additions and 389 deletions.
5 changes: 5 additions & 0 deletions .changeset/mighty-seas-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/nextjs-mf': patch
---

add next 15 to peer deps
8 changes: 4 additions & 4 deletions apps/3000-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"antd": "5.19.1",
"@ant-design/cssinjs": "^1.21.0",
"antd": "5.19.1",
"lodash": "4.17.21",
"next": "14.2.15",
"next": "14.2.0",
"react": "18.3.1"
},
"devDependencies": {
"@module-federation/nextjs-mf": "workspace:*",
"@module-federation/utilities": "workspace:*",
"@module-federation/runtime": "workspace:*"
"@module-federation/runtime": "workspace:*",
"@module-federation/utilities": "workspace:*"
},
"scripts": {
"start": "next start",
Expand Down
6 changes: 3 additions & 3 deletions apps/3001-shop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"antd": "5.19.1",
"@ant-design/cssinjs": "^1.21.0",
"antd": "5.19.1",
"lodash": "4.17.21",
"next": "14.2.15",
"next": "14.2.0",
"react": "18.3.1"
},
"devDependencies": {
"@module-federation/nextjs-mf": "workspace:*",
"@module-federation/sdk": "workspace:*",
"@module-federation/runtime": "workspace:*",
"@module-federation/sdk": "workspace:*",
"@module-federation/utilities": "workspace:*"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions apps/3002-checkout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"antd": "5.19.1",
"@ant-design/cssinjs": "^1.21.0",
"antd": "5.19.1",
"lodash": "4.17.21",
"next": "14.2.15",
"next": "14.2.0",
"react": "18.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions apps/website-new/docs/en/guide/framework/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This plugin enables Module Federation on Next.js

## Supports

- next ^14 || ^13 || ^12
- next ^15 || ^14 || ^13 || ^12
- Server-Side Rendering
- Pages router

Expand All @@ -21,7 +21,7 @@ I set `process.env.NEXT_PRIVATE_LOCAL_WEBPACK = 'true'` inside this plugin, but

"Local Webpack" means you must have webpack installed as a dependency, and next will not use its bundled copy of webpack which cannot be used as i need access to all of webpack internals

- `NEXT_PRIVATE_LOCAL_WEBPACK=true next dev` or `next build`
- `cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next dev` or `next build`
- `npm install webpack`

## Usage
Expand Down
6 changes: 4 additions & 2 deletions apps/website-new/docs/en/practice/frameworks/next/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import {Steps, Tabs, Tab, Badge, SourceCode} from '@theme';
<Badge text="Next 12" type="info" />
<Badge text="Next 13" type="info" />
<Badge text="Next 14" type="info" />
<Badge text="Next 15" type="info" />
<Badge text="SSR (Pages Router)" type="info" />
</span>
<Badge text="App Router" type="danger" />
<Badge text="Not Reccomended" type="warning" />
#

:::tip Demo Reference
Expand Down Expand Up @@ -157,9 +159,9 @@ export default nextConfig;
"Local Webpack" means you must have webpack installed as a dependency, and next will not use its bundled copy of webpack which cannot be used as it does not export all of Webpacks internals

```bash title="shell"
NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
# or
NEXT_PRIVATE_LOCAL_WEBPACK=true next build
cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next build
```

`.env` can be set as well, but can be unreliable in setting `NEXT_PRIVATE_LOCAL_WEBPACK` in time.
Expand Down
2 changes: 1 addition & 1 deletion apps/website-new/docs/zh/guide/framework/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const DEFAULT_SHARE_SCOPE: SharedObject = {

"本地 Webpack" 意味着你必须将 webpack 安装为依赖项,并且 next 不会使用其捆绑的 webpack 副本,因为需要访问所有 webpack 内部

- 使用 `NEXT_PRIVATE_LOCAL_WEBPACK=true next dev``next build`
- 使用 `cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next dev``next build`
- `npm install webpack`

## 使用方法
Expand Down
4 changes: 2 additions & 2 deletions apps/website-new/docs/zh/practice/frameworks/next/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ export default nextConfig;
“本地 Webpack”意味着你必须将 webpack 作为依赖项安装,接下来将不会使用其捆绑的 webpack 副本,该副本无法使用,因为它不会导出所有 Webpack 内部结构

```bash title="shell"
NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next dev
# or
NEXT_PRIVATE_LOCAL_WEBPACK=true next build
cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next build
```

`.env` 也可以设置,但及时设置 `NEXT_PRIVATE_LOCAL_WEBPACK` 可能不可靠。
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"glob": "^11.0.0",
"kill-port": "^2.0.1",
"lodash.get": "4.4.2",
"next": "14.2.15",
"next": "14.2.0",
"openai": "^4.63.0",
"rambda": "7.5.0",
"react": "18.3.1",
Expand Down Expand Up @@ -101,11 +101,11 @@
"@nx/cypress": "20.0.0",
"@nx/devkit": "20.0.0",
"@nx/esbuild": "20.0.0",
"@nx/eslint": "20.0.0",
"@nx/eslint-plugin": "20.0.0",
"@nx/express": "20.0.0",
"@nx/jest": "20.0.0",
"@nx/js": "20.0.3",
"@nx/eslint": "20.0.0",
"@nx/next": "20.0.0",
"@nx/node": "20.0.0",
"@nx/react": "20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs-mf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ I set `process.env.NEXT_PRIVATE_LOCAL_WEBPACK = 'true'` inside this plugin, but

"Local Webpack" means you must have webpack installed as a dependency, and next will not use its bundled copy of webpack which cannot be used as i need access to all of webpack internals

- `NEXT_PRIVATE_LOCAL_WEBPACK=true next dev` or `next build`
- `cross-env NEXT_PRIVATE_LOCAL_WEBPACK=true next dev` or `next build`
- `npm install webpack`

## Usage
Expand Down
6 changes: 3 additions & 3 deletions packages/nextjs-mf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
},
"peerDependencies": {
"webpack": "^5.40.0",
"next": "^12 || ^13 || ^14",
"react": "^17 || ^18",
"react-dom": "^17 || ^18",
"next": "^12 || ^13 || ^14 || ^15",
"react": "^17 || ^18 || ^19",
"react-dom": "^17 || ^18 || ^19",
"styled-jsx": "*"
},
"peerDependenciesMeta": {
Expand Down
Loading

0 comments on commit 450aa37

Please sign in to comment.