[HIGH] async request API
Will break most layout and page code. Needs a rewrite.
https://nextjs.org/blog/next-15#async-request-apis-breaking-change
cookies(), params, headers() all became async. Refactoring hell.
// before
function ServerComponent(props) {
const token = cookies().get("token");
const { appId } = props.params;
const contentType = headers().get("Content-Type");
}
// after
async function ServerComponent(props) {
// 全都要 await...
const token = (await cookies()).get("token");
const { appId } = await props.params;
const contentType = (await headers()).get("Content-Type");
}
Because of this, it’s still easier to treat every page and layout as a server component. Pages and layouts that already became client components will need some convention: split the client part into another file. That may affect the file structure, so you need to think about how to change it.
[LOW] instrumentation is stable
https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
You can now drop an instrumentation.ts under the src folder for frontend observability.
Maybe a better place to put Sentry:
// instrumentation.ts
export async function onRequestError(err, request, context) {
await fetch("https://...", {
method: "POST",
body: JSON.stringify({ message: err.message, request, context }),
headers: { "Content-Type": "application/json" },
});
}
export async function register() {
// init your favorite observability provider SDK
}
The docs also cover another use case: setting up the environment before a route handler runs. Think of it as Jest’s beforeEach, or Electron’s preload script.
[MEDIUM] turbopack is stable
turbopack forces lighteningcss (not postcss). Its parse is clearly much stricter than postcss. Needs more research later.
Prod still doesn’t support turbopack though. After you bring it in, not only are server and client inconsistent, dev and prod are inconsistent too (vite, huh…).
Just append --turbo to the dev scripts to try it.
[MEDIUM] Build performance
As everyone knows, when Next.js starts doing perf work it means a lot of behavior is about to change.
- RSC now supports HMR
- The rest is static export updates
[MEDIUM] Global CSS chunking strategy changed
https://github.com/vercel/next.js/pull/67373
The CSS chunking introduced in 14.2 also chunked global CSS. The current strategy seems to only chunk CSS Modules, so it shouldn’t affect the project now. But I can’t be sure Next.js’s implementation is correct, so this needs testing.
[LOW] Lots of bundler improvements
Just be aware. In a monorepo, don’t use next’s built-in bundle features, and don’t use next/dynamic anymore. Feels like they can’t even maintain it themselves.