Skip to main content

版本 14

从 13 升级到 14

¥Upgrading from 13 to 14

要更新到 Next.js 版本 14,请使用你首选的包管理器运行以下命令:

¥To update to Next.js version 14, run the following command using your preferred package manager:

npm i next@latest react@latest react-dom@latest eslint-config-next@latest
yarn add next@latest react@latest react-dom@latest eslint-config-next@latest
pnpm up next react react-dom eslint-config-next --latest
bun add next@latest react@latest react-dom@latest eslint-config-next@latest

很高兴知道:如果你使用 TypeScript,请确保还将 @types/react@types/react-dom 升级到最新版本。

¥Good to know: If you are using TypeScript, ensure you also upgrade @types/react and @types/react-dom to their latest versions.

v14 总结

¥v14 Summary

  • 由于 16.x 已结束生命周期,最低 Node.js 版本已从 16.14 升至 18.17。

    ¥The minimum Node.js version has been bumped from 16.14 to 18.17, since 16.x has reached end-of-life.

  • next export 命令已被删除,以支持 output: 'export' 配置。请参阅 docs 了解更多信息。

    ¥The next export command has been removed in favor of output: 'export' config. Please see the docs for more information.

  • ImageResponsenext/server 导入已重命名为 next/og代码模式可用 可以安全、自动地重命名你的导入。

    ¥The next/server import for ImageResponse was renamed to next/og. A codemod is available to safely and automatically rename your imports.

  • @next/font 封装已被完全删除,取而代之的是内置 next/font代码模式可用 可以安全、自动地重命名你的导入。

    ¥The @next/font package has been fully removed in favor of the built-in next/font. A codemod is available to safely and automatically rename your imports.

  • next-swc 的 WASM 目标已被删除。

    ¥The WASM target for next-swc has been removed.