windmill-labs/windmill · error

Expected a JS bundle in esbuild output but none found

Error message

Expected a JS bundle in esbuild output but none found

What it means

Sanity check on esbuild output in createBundle: the build succeeded (no errors), but among result.outputFiles (write:false mode) no file path ends in .js — so there is no JavaScript payload to ship. This is an esbuild configuration/output-shape anomaly, not a user code error: normally at least the entry's JS chunk is emitted. A misconfigured outfile/entry or an unexpected esbuild-wasm fallback path is the likely input at fault.

Source

Thrown at cli/src/commands/app/bundle.ts:456

  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 ?? "" };

  } finally {
    // Stop the native esbuild service so the process can exit (no-op for wasm).
    await stopEsbuild();
  }
}

/**
 * Gets the esbuild build options for use in watch mode (dev server)
 * @param entryPoint Entry point file

View on GitHub (pinned to e474e8803c)

Solutions

  1. Re-run the bundle to rule out a transient esbuild-wasm/native mismatch (the loader falls back transparently on version mismatch)
  2. Check that the entry point is a real script module (not CSS-only) and no custom out-extension/outfile settings strip the .js suffix
  3. Report with the esbuild version if persistent — the result.outputFiles array having no .js entry is an internal contract break
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at cli/src/commands/app/bundle.ts:456 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/005b6ec794a26424. Report an issue: GitHub.