{"record":{"id":"6c89c081eaadbbff","repo":"denoland/deno","slug":"esbuild-produced-no-javascript-output","errorCode":null,"errorMessage":"esbuild produced no JavaScript output","messagePattern":"esbuild produced no JavaScript output","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/bundle/mod.rs","lineNumber":938,"sourceCode":"  )?;\n\n  for file in &output_files {\n    let processed = maybe_process_contents(\n      file,\n      should_replace_require_shim(bundle_flags.platform),\n      bundle_flags.minify,\n    )?;\n    if !processed.is_js {\n      continue;\n    }\n    return Ok(\n      processed\n        .into_contents()\n        .unwrap_or_else(|| file.contents.to_vec()),\n    );\n  }\n\n  deno_core::anyhow::bail!(\"esbuild produced no JavaScript output\")\n}\n\nfn metafile_from_response(\n  response: &BuildResponse,\n) -> Result<esbuild_client::Metafile, AnyError> {\n  Ok(serde_json::from_str::<esbuild_client::Metafile>(\n    response.metafile.as_deref().ok_or_else(|| {\n      deno_core::anyhow::anyhow!(\"expected a metafile to be present\")\n    })?,\n  )?)\n}\n\nasync fn bundle_watch(\n  flags: Arc<Flags>,\n  bundler: EsbuildBundler,\n  minified: bool,\n  platform: BundlePlatform,\n  output_dir: Option<&Path>,","sourceCodeStart":920,"sourceCodeEnd":956,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/bundle/mod.rs#L920-L956","documentation":"The in-memory bundling helper returns the first JavaScript output file it finds (skipping non-JS outputs like CSS and sourcemaps); if none of esbuild's outputs is JS, it bails (cli/tools/bundle/mod.rs:922-938). The entry's graph produced only non-JS artifacts - classically a CSS-only or asset-only entrypoint.","triggerScenarios":"Bundling an entry whose outputs are all CSS/maps (e.g. a stylesheet passed where a JS/TS module is expected); a module graph that tree-shakes to zero JS; outputs filtered out because maybe_process_contents marks them non-JS.","commonSituations":"Build scripts passing style.css or an HTML/CSS asset as the entry to a flow that expects JS bytes; renaming entries such that the real JS entry is no longer passed.","solutions":["Pass a JS/TS module as the entrypoint - CSS should be imported from JS (import './style.css') rather than bundled as the entry","Verify the entry file actually contains executable module code and is not empty/type-only","Check that the correct entry path is being used (typo pointing at a sibling .css/.map file)"],"exampleFix":"// before: CSS as entry - no JS output\n// run: bundleEntry('src/styles.css')  -> esbuild produced no JavaScript output\n// after: JS entry that imports the CSS\n// src/main.ts: import './styles.css'; export function app() { /* ... */ }\n// run: bundleEntry('src/main.ts')","handlingStrategy":"validation","validationCode":"const JS_ENTRY = /\\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/i;\nfunction assertJsEntry(entry: string) {\n  if (!JS_ENTRY.test(entry)) {\n    throw new Error(`entry must be a JS/TS module, got: ${entry} (import CSS from JS instead)`);\n  }\n}","typeGuard":"function isJsModulePath(path: string): boolean {\n  return /\\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/i.test(path);\n}","tryCatchPattern":null,"preventionTips":["Import stylesheets from JS modules rather than bundling CSS directly","Assert the entry file is non-empty and contains module code before bundling"],"tags":["bundle","esbuild","output","css","entrypoint"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}