Problem: The tsconfig.json sets target: "ES2017", which causes TypeScript to downlevel modern JavaScript syntax (async iteration, optional chaining, nullish coalescing) to ES2017-compatible output. Since the runtime environment is Node.js 24 (per package.json "node": "=24" and the Dockerfile base image node:24-bookworm-slim), this adds unnecessary transpilation overhead and produces larger, slower code. Node 24 natively supports all ES2022+ features.
Evidence:
// tsconfig.json
{
"compilerOptions": {
"target": "ES2017",
// ...
}
}
# Dockerfile
FROM node:24-bookworm-slim AS base
// package.json
"engines": { "node": "=24" }
Node 24 supports:
ES2022 features natively (class fields, static initialization blocks, .at(), regex match indices)
ESNext async iteration, top-level await, and Array.fromAsync (ES2024+)
- The Next.js
bundler module resolution already handles the rest
Acceptance:
Problem: The
tsconfig.jsonsetstarget: "ES2017", which causes TypeScript to downlevel modern JavaScript syntax (async iteration, optional chaining, nullish coalescing) to ES2017-compatible output. Since the runtime environment is Node.js 24 (perpackage.json"node": "=24"and the Dockerfile base imagenode:24-bookworm-slim), this adds unnecessary transpilation overhead and produces larger, slower code. Node 24 natively supports all ES2022+ features.Evidence:
Node 24 supports:
ES2022features natively (class fields, static initialization blocks,.at(), regex match indices)ESNextasync iteration, top-level await, andArray.fromAsync(ES2024+)bundlermodule resolution already handles the restAcceptance:
tsconfig.jsontarget is changed from"ES2017"to"ES2022"(or"ESNext")npm run typecheckpasses with no new errorsnpm run buildsucceeds and produces a working Next.js standalone build.next/bundle size is smaller than before