2026-02-06 15:28:35 -08:00
|
|
|
import type { NextConfig } from "next";
|
Web app: switch to Next.js standalone build for npm packaging
Ship a self-contained standalone server with the npm package so
`npm i -g ironclaw` can serve the web UI without runtime `npm install`
or `next build`. This eliminates the fragile first-boot build step
and cuts the cold-start time for the gateway web app.
Changes:
- next.config.ts: enable `output: "standalone"` and set
`outputFileTracingRoot` to the monorepo root so pnpm workspace
deps are traced correctly. Remove the now-unnecessary manual
webpack externals for Node.js built-ins.
- package.json: update `files` to ship only the standalone build
output, static assets, and public dir (instead of the entire
`apps/web/` tree). Add `web:build` and `web:prepack` to the
`prepack` script so the standalone server is built and its
static/public assets are copied into place before publish. Bump
version to 2026.2.10-1.5.
- server-web-app.ts: rewrite the web app lifecycle to prefer the
pre-built standalone `server.js` in production. Add
`resolveStandaloneServerJs`, `hasStandaloneBuild`,
`hasLegacyNextBuild`, and `isInWorkspace` helpers. In dev
workspaces, fall back to building on-the-fly or legacy
`next start`. Export key functions for testability.
- server-web-app.test.ts: add comprehensive unit tests covering
path resolution, standalone/legacy build detection,
ensureWebAppBuilt scenarios (skip, disabled, dev, standalone,
legacy, missing), startWebAppIfEnabled (skip, disabled, null
config, missing dir, standalone start, missing build error,
default port, graceful stop).
- workspace-sidebar.tsx: update sidebar branding to "Ironclaw".
Published as ironclaw@2026.2.10-1.5.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 19:03:01 -08:00
|
|
|
import path from "node:path";
|
2026-02-21 13:10:32 -08:00
|
|
|
import { homedir } from "node:os";
|
2026-02-06 15:28:35 -08:00
|
|
|
|
|
|
|
|
const nextConfig: NextConfig = {
|
Web app: switch to Next.js standalone build for npm packaging
Ship a self-contained standalone server with the npm package so
`npm i -g ironclaw` can serve the web UI without runtime `npm install`
or `next build`. This eliminates the fragile first-boot build step
and cuts the cold-start time for the gateway web app.
Changes:
- next.config.ts: enable `output: "standalone"` and set
`outputFileTracingRoot` to the monorepo root so pnpm workspace
deps are traced correctly. Remove the now-unnecessary manual
webpack externals for Node.js built-ins.
- package.json: update `files` to ship only the standalone build
output, static assets, and public dir (instead of the entire
`apps/web/` tree). Add `web:build` and `web:prepack` to the
`prepack` script so the standalone server is built and its
static/public assets are copied into place before publish. Bump
version to 2026.2.10-1.5.
- server-web-app.ts: rewrite the web app lifecycle to prefer the
pre-built standalone `server.js` in production. Add
`resolveStandaloneServerJs`, `hasStandaloneBuild`,
`hasLegacyNextBuild`, and `isInWorkspace` helpers. In dev
workspaces, fall back to building on-the-fly or legacy
`next start`. Export key functions for testability.
- server-web-app.test.ts: add comprehensive unit tests covering
path resolution, standalone/legacy build detection,
ensureWebAppBuilt scenarios (skip, disabled, dev, standalone,
legacy, missing), startWebAppIfEnabled (skip, disabled, null
config, missing dir, standalone start, missing build error,
default port, graceful stop).
- workspace-sidebar.tsx: update sidebar branding to "Ironclaw".
Published as ironclaw@2026.2.10-1.5.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 19:03:01 -08:00
|
|
|
// Produce a self-contained standalone build so npm global installs
|
|
|
|
|
// can run the web app with `node server.js` — no npm install or
|
|
|
|
|
// next build required at runtime.
|
|
|
|
|
output: "standalone",
|
|
|
|
|
|
|
|
|
|
// Required for pnpm monorepos: trace dependencies from the workspace
|
|
|
|
|
// root so the standalone build bundles its own node_modules correctly
|
|
|
|
|
// instead of resolving through pnpm's virtual store symlinks.
|
|
|
|
|
outputFileTracingRoot: path.join(import.meta.dirname, "..", ".."),
|
|
|
|
|
|
2026-02-06 15:28:35 -08:00
|
|
|
// Allow long-running API routes for agent streaming
|
|
|
|
|
serverExternalPackages: [],
|
2026-02-08 18:02:25 -08:00
|
|
|
|
2026-02-11 16:45:07 -08:00
|
|
|
// Transpile ESM-only packages so webpack can bundle them
|
|
|
|
|
transpilePackages: ["react-markdown", "remark-gfm"],
|
2026-02-21 13:10:32 -08:00
|
|
|
|
|
|
|
|
webpack: (config, { dev }) => {
|
|
|
|
|
if (dev) {
|
|
|
|
|
config.watchOptions = {
|
|
|
|
|
...config.watchOptions,
|
|
|
|
|
ignored: [
|
|
|
|
|
"**/node_modules/**",
|
|
|
|
|
"**/.git/**",
|
|
|
|
|
"**/dist/**",
|
|
|
|
|
"**/.next/**",
|
|
|
|
|
path.join(homedir(), ".openclaw", "**"),
|
|
|
|
|
],
|
|
|
|
|
poll: 1500,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return config;
|
|
|
|
|
},
|
2026-02-06 15:28:35 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default nextConfig;
|