为什么下次构建后未创建独立文件夹

jog*_*ito 3 next.js

我正在使用 next 12.1.* 我有前端组件,以及使用 next 提供的后端 API。我已启用输出文件跟踪,通过将输出添加到我的 next.js 配置中,在下一次构建后,不会创建独立文件夹,也不会创建提到的简约 server.js 文件。

我需要做什么才能实现此功能?

小智 6

我今天遇到了同样的问题。使用之前的实验属性outputStandalone。我只是将其与提议的新方法一起添加。

\n
/** @type {import(\'next\').NextConfig} */\nconst nextConfig = {\n  reactStrictMode: true,\n  output: \'standalone\',\n  experimental: {\n    outputStandalone: true,\n  }\n}\n\nmodule.exports = nextConfig\n
Run Code Online (Sandbox Code Playgroud)\n

检查了存储库的问题和 PR,并发现了一个更新(https://github.com/vercel/next.js/pull/37994/commits/96d8e175c6e3679b3a4a26d224dd5fe6b6c39338),该更新只有几天的时间,因此它没有 \xe2\x80 \x99t 已进入 12.1.6。然后我也碰巧注意到 with-docker 示例的链接位于 canary 分支上。

\n

  • `output: 'standalone'` 选项现在应该可以从最新的 [`12.2.0` 版本](https://github.com/vercel/next.js/releases/tag/v12.2.0) 开始工作。 (5认同)