Skip to content
Snippets Groups Projects
Commit 119af438 authored by Laurie Voss's avatar Laurie Voss
Browse files

next.config.js has to be different for express/python backends

parent 871341ab
No related branches found
No related tags found
No related merge requests found
...@@ -88,7 +88,7 @@ export async function createApp({ ...@@ -88,7 +88,7 @@ export async function createApp({
path.join(root, "README.md"), path.join(root, "README.md"),
); );
} else { } else {
await installTemplate({ ...args, backend: true }); await installTemplate({ ...args, backend: true, forBackend: framework });
} }
process.chdir(root); process.chdir(root);
......
...@@ -103,6 +103,7 @@ const installTSTemplate = async ({ ...@@ -103,6 +103,7 @@ const installTSTemplate = async ({
ui, ui,
eslint, eslint,
customApiPath, customApiPath,
forBackend,
}: InstallTemplateArgs) => { }: InstallTemplateArgs) => {
console.log(bold(`Using ${packageManager}.`)); console.log(bold(`Using ${packageManager}.`));
...@@ -120,6 +121,26 @@ const installTSTemplate = async ({ ...@@ -120,6 +121,26 @@ const installTSTemplate = async ({
rename, rename,
}); });
/**
* If the backend is next.js, rename next.config.app.js to next.config.js
* If not, rename next.config.static.js to next.config.js
*/
if (framework == "nextjs" && forBackend === "nextjs") {
const nextConfigAppPath = path.join(root, "next.config.app.js");
const nextConfigPath = path.join(root, "next.config.js");
await fs.rename(nextConfigAppPath, nextConfigPath);
// delete next.config.static.js
const nextConfigStaticPath = path.join(root, "next.config.static.js");
await fs.rm(nextConfigStaticPath);
} else if (framework == "nextjs" && typeof forBackend === "undefined") {
const nextConfigStaticPath = path.join(root, "next.config.static.js");
const nextConfigPath = path.join(root, "next.config.js");
await fs.rename(nextConfigStaticPath, nextConfigPath);
// delete next.config.app.js
const nextConfigAppPath = path.join(root, "next.config.app.js");
await fs.rm(nextConfigAppPath);
}
/** /**
* Copy the selected chat engine files to the target directory and reference it. * Copy the selected chat engine files to the target directory and reference it.
*/ */
......
...@@ -17,4 +17,5 @@ export interface InstallTemplateArgs { ...@@ -17,4 +17,5 @@ export interface InstallTemplateArgs {
eslint: boolean; eslint: boolean;
customApiPath?: string; customApiPath?: string;
openAIKey?: string; openAIKey?: string;
forBackend?: string;
} }
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
images: { unoptimized: true },
experimental: {
serverComponentsExternalPackages: ["llamaindex"],
outputFileTracingIncludes: {
"/*": ["./cache/**/*"],
},
},
};
module.exports = nextConfig;
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
images: { unoptimized: true },
experimental: {
serverComponentsExternalPackages: ["llamaindex"],
outputFileTracingIncludes: {
"/*": ["./cache/**/*"],
},
},
};
module.exports = nextConfig;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment