windmill-labs/windmill · error
Build failed with errors
Error message
Build failed with errors
What it means
Post-build guard in createBundle: esbuild returned from build() without throwing, but result.errors is non-empty — esbuild reports some errors (e.g. unresolved imports, syntax errors in imported files) through the result object rather than as a thrown exception. Each error's text is logged to the console before this Error is thrown, so the terminal already shows the specific esbuild diagnostics; this throw converts the soft-failure into a hard stop so no half-built bundle is used.
Source
Thrown at cli/src/commands/app/bundle.ts:446
// read anyway. Native esbuild supports write:false + outputFiles too.
write: false as const,
define: {
"process.env.NODE_ENV": production ? '"production"' : '"development"',
},
plugins: [...frameworkPlugins, wmillPlugin, ...sharedUiPlugins],
};
log.info(colors.blue("📦 Building bundle..."));
try {
const result = await esbuild.build(buildOptions);
if (result.errors.length > 0) {
log.error(colors.red("❌ Build failed:"));
result.errors.forEach((error: any) => {
log.error(colors.red(error.text));
});
throw new Error("Build failed with errors");
}
log.info(colors.green("✅ Bundle created successfully"));
const outputFiles = result.outputFiles ?? [];
const jsFile = outputFiles.find((f) => f.path.endsWith(".js"));
const cssFile = outputFiles.find((f) => f.path.endsWith(".css"));
if (!jsFile) {
throw new Error("Expected a JS bundle in esbuild output but none found");
}
try {
fs.rmSync(distDir, { recursive: true });
} catch {
//ignore
}
return { js: jsFile.text, css: cssFile?.text ?? "" };View on GitHub (pinned to e474e8803c)
Solutions
- Scroll up to the '❌ Build failed:' block — each printed line is one esbuild error.text; fix those source/typing issues and re-bundle
- For unresolved imports, ensure dependencies are in package.json and node_modules exists (the bundler can run npm install via ensureNodeModules)
- For JSX/TS syntax errors, check the entry file extension matches the framework (tsx for React, ts for Svelte)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at cli/src/commands/app/bundle.ts:446 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/0ac197dcd4fea7d2.
Report an issue: GitHub.