mirror of
https://github.com/Yidadaa/ChatGPT-Next-Web.git
synced 2025-08-09 11:19:50 +08:00
feat: allow to disable chunk building by setting DISABLE_CHUNK=1
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import webpack from "webpack";
|
||||
|
||||
const mode = process.env.BUILD_MODE ?? "standalone";
|
||||
console.log("[Next] build mode", mode);
|
||||
|
||||
const disableChunk = !!process.env.DISABLE_CHUNK || mode === "export";
|
||||
console.log("[Next] build with chunk: ", !disableChunk);
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
webpack(config) {
|
||||
@@ -9,6 +14,12 @@ const nextConfig = {
|
||||
use: ["@svgr/webpack"],
|
||||
});
|
||||
|
||||
if (disableChunk) {
|
||||
config.plugins.push(
|
||||
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
||||
);
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
output: mode,
|
||||
|
Reference in New Issue
Block a user