Skip to content
Snippets Groups Projects
Commit 21674fa7 authored by thucpn's avatar thucpn
Browse files

fix: not bundle next

parent 5865c855
No related branches found
No related tags found
No related merge requests found
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
distDir: "../static",
output: "export", output: "export",
}; };
......
...@@ -18,9 +18,7 @@ ...@@ -18,9 +18,7 @@
} }
}, },
"files": [ "files": [
"dist", "dist"
"static",
".next"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -28,9 +26,13 @@ ...@@ -28,9 +26,13 @@
"directory": "packages/server" "directory": "packages/server"
}, },
"scripts": { "scripts": {
"dev:next": "cd ./next && next dev", "clean": "rm -rf ./dist next/.next next/out",
"prebuild": "cd ./next && next build && cp -r .next ../", "prebuild": "pnpm clean",
"build": "bunchee", "build": "bunchee",
"postbuild": "pnpm copy:next-src && pnpm build:static && pnpm copy:static",
"copy:next-src": "cp -r ./next ./dist/next",
"build:static": "cd ./next && next build",
"copy:static": "cp -r ./next/out ./dist/static",
"dev": "bunchee --watch" "dev": "bunchee --watch"
}, },
"devDependencies": { "devDependencies": {
......
...@@ -11,8 +11,9 @@ export class LlamaIndexServer { ...@@ -11,8 +11,9 @@ export class LlamaIndexServer {
workflowFactory: () => Promise<ServerWorkflow> | ServerWorkflow; workflowFactory: () => Promise<ServerWorkflow> | ServerWorkflow;
constructor({ workflow, ...nextAppOptions }: LlamaIndexServerOptions) { constructor({ workflow, ...nextAppOptions }: LlamaIndexServerOptions) {
const nextDir = path.join(__dirname, ".."); // location of the .next after build next app const nextDir = path.join(__dirname, "./next");
this.app = next({ ...nextAppOptions, dir: nextDir }); const dev = process.env.NODE_ENV !== "production";
this.app = next({ ...nextAppOptions, dev, dir: nextDir });
this.port = nextAppOptions.port ?? 3000; this.port = nextAppOptions.port ?? 3000;
this.workflowFactory = workflow; this.workflowFactory = workflow;
} }
......
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