Skip to content

Commit f11039a

Browse files
authored
feat: use Next.js 16 (#2613)
1 parent 115cde8 commit f11039a

File tree

17 files changed

+111
-498
lines changed

17 files changed

+111
-498
lines changed

apps/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"@react-email/preview-server": "workspace:*",
1919
"@types/react": "^19",
2020
"@types/react-dom": "^19",
21-
"next": "^15.3.2"
21+
"next": "16.0.1"
2222
}
2323
}

apps/web/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./.next/types/routes.d.ts" />
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"email-dev": "workspace:*",
2626
"framer-motion": "12.23.22",
2727
"lucide-react": "^0.544.0",
28-
"next": "15.5.2",
28+
"next": "16.0.1",
2929
"prism-react-renderer": "2.4.1",
3030
"react": "^19",
3131
"react-dom": "^19",

examples/resend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "next start"
1010
},
1111
"dependencies": {
12-
"next": "^15",
12+
"next": "^16",
1313
"@react-email/components": "^0.0.36",
1414
"react": "^19",
1515
"react-dom": "^19",

examples/scaleway/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@scaleway/sdk": "^1",
13-
"next": "^15",
13+
"next": "^16",
1414
"@react-email/components": "^0.0.36",
1515
"react": "^19",
1616
"react-dom": "^19"
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
/** @type {import('next').NextConfig} */
2-
module.exports = {
3-
// this is needed so that the code for building emails works properly
4-
webpack: (
5-
/** @type {import('webpack').Configuration & { externals: string[] }} */
6-
config,
7-
{ isServer },
8-
) => {
9-
if (isServer) {
10-
config.externals.push('esbuild');
11-
}
1+
import type { NextConfig } from 'next';
122

13-
return config;
14-
},
3+
const nextConfig: NextConfig = {
4+
serverExternalPackages: ['esbuild'],
155
// Noticed an issue with typescript transpilation when going from Next 14.1.1 to 14.1.2
166
// and I narrowed that down into this PR https://github.com/vercel/next.js/pull/62005
177
//
@@ -20,3 +10,5 @@ module.exports = {
2010
// TODO: Open an issue on Nextjs about this.
2111
transpilePackages: ['react-email'],
2212
};
13+
14+
export default nextConfig;

packages/preview-server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"json5": "2.2.3",
4141
"log-symbols": "4.1.0",
4242
"module-punycode": "npm:[email protected]",
43-
"next": "15.5.2",
43+
"next": "16.0.1",
4444
"node-html-parser": "7.0.1",
4545
"ora": "5.4.1",
4646
"pretty-bytes": "6.1.1",

packages/preview-server/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"tailwind-internals.d.ts",
4040
"**/*.ts",
4141
"**/*.tsx",
42-
".next/types/**/*.ts"
42+
".next/types/**/*.ts",
43+
".next/dev/types/**/*.ts"
4344
],
4445
"exclude": [".next", "dist", "node_modules"]
4546
}

packages/react-email/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@types/babel__traverse": "7.20.7",
5151
"@types/mime-types": "2.1.4",
5252
"@types/prompts": "2.4.9",
53-
"next": "^15.3.2",
53+
"next": "16.0.1",
5454
"react": "19.0.0",
5555
"react-dom": "19.0.0",
5656
"typescript": "5.8.3"

packages/react-email/src/commands/build.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,17 @@ module.exports = {
8888
PREVIEW_SERVER_LOCATION: '${builtPreviewAppPath.replace(/\\/g, '/')}',
8989
USER_PROJECT_LOCATION: userProjectLocation
9090
},
91-
// this is needed so that the code for building emails works properly
92-
webpack: (
93-
/** @type {import('webpack').Configuration & { externals: string[] }} */
94-
config,
95-
{ isServer }
96-
) => {
97-
if (isServer) {
98-
config.externals.push('esbuild');
99-
}
100-
101-
return config;
102-
},
91+
serverExternalPackages: ['esbuild'],
10392
typescript: {
10493
ignoreBuildErrors: true
10594
},
106-
eslint: {
107-
ignoreDuringBuilds: true
108-
},
10995
experimental: {
11096
webpackBuildWorker: true
11197
},
11298
}`;
11399

100+
await fs.promises.rm(path.resolve(builtPreviewAppPath, './next.config.ts'));
101+
114102
await fs.promises.writeFile(
115103
path.resolve(builtPreviewAppPath, './next.config.js'),
116104
nextConfigContents,
@@ -202,7 +190,8 @@ const updatePackageJson = async (builtPreviewAppPath: string) => {
202190
dependencies: Record<string, string>;
203191
devDependencies: Record<string, string>;
204192
};
205-
packageJson.scripts.build = 'next build';
193+
// Turbopack has some errors with the imports in @react-email/tailwind
194+
packageJson.scripts.build = 'next build --webpack';
206195
packageJson.scripts.start = 'next start';
207196
delete packageJson.scripts.postbuild;
208197

@@ -214,12 +203,6 @@ const updatePackageJson = async (builtPreviewAppPath: string) => {
214203
packageJson.dependencies[dependency] = version.replace('workspace:', '');
215204
}
216205

217-
// We remove this one to avoid having resolve issues on our demo build process.
218-
// This is only used in the `export` command so it's irrelevant to have it here.
219-
//
220-
// See `src/actions/render-email-by-path` for more info on how we render the
221-
// email templates without `@react-email/render` being installed.
222-
delete packageJson.devDependencies['@react-email/render'];
223206
delete packageJson.devDependencies['@react-email/components'];
224207
delete packageJson.scripts.prepare;
225208

0 commit comments

Comments
 (0)