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

问题描述 投票:0回答:2

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

我需要做什么才能启用此功能?

next.js
2个回答
7
投票

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

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  output: 'standalone',
  experimental: {
    outputStandalone: true,
  }
}

module.exports = nextConfig

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


0
投票

Next 14 似乎已经删除了实验密钥根据 This Vercel 示例

// next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
  output: "standalone",
};
© www.soinside.com 2019 - 2024. All rights reserved.