Skip to content

Commit 40536c2

Browse files
committed
Upgrade to Next.js@15 and React@19
This upgrades Next.js by running `npx @next/codemod@canary upgrade latest`, which also runs `npx codemod@latest react/19/migration-recipe`. Additional manual changes I had to do: 1. Disable Turbopack in dev mode. It wasn't clear to me how to use raw-loader to load .ftl files, so I postponed that for later. 2. Turned `getExperimentationId` into an async function. I did this because it calls `headers()`, which is async now. All its invocations where in async functions anyway. 3. Server components should now pass the accept language to get l10n In most environments, getL10n() and getL10nBundles() can be synchronous functions, and just read the language preferences directly. However, on the server-side, reading the headers is now asynchronous. Thus, I've modified the l10n generation functions to require the accept language argument if no sync function can be provided that returns it. Not great, but better than forcing the same functions in e.g. client components to be async. An alternative would have been to simply make the getL10n() and getL10nBundles() functions asynchronous for the server, but I imagine that would be even more confusing than just making an optional argument required. 4. Dynamically import react-dom/server(.edge) In `/src/emails/renderEmail`, we _want_ to render HTML to a string, rather than generating a server component that the server serves, but Next.js throws an error if we do that directly. Hence, I had to replace that with a dynamic import as a workaround, turning `renderEmail` into an async function. Additionally, I got errors in the tests when not importing it from .edge. 5. Move `serverExternalPackages` out of `experimental`
1 parent 2cd4a59 commit 40536c2

File tree

78 files changed

+1828
-1054
lines changed

Some content is hidden

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

78 files changed

+1828
-1054
lines changed

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

next.config.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,9 @@ const nextConfig = {
175175

176176
return config;
177177
},
178-
experimental: {
179-
// Without this setting, Next.js has Webpack trying and failing to load
180-
// uglify-js when compiling MJML email templates to HTML in `renderEmail.ts`:
181-
serverComponentsExternalPackages: ["mjml"],
182-
// Sentry 8.x requires `instrumentation.ts` vs. it's previous custom approach.
183-
instrumentationHook: true,
184-
},
178+
// Without this setting, Next.js has Webpack trying and failing to load
179+
// uglify-js when compiling MJML email templates to HTML in `renderEmail.ts`:
180+
serverExternalPackages: ["mjml"],
185181
};
186182

187183
const sentryOptions = {

0 commit comments

Comments
 (0)