{"record":{"id":"40eeb22375dbc912","repo":"denoland/deno","slug":"output-is-not-supported-with-html-entrypoints-u","errorCode":null,"errorMessage":"--output is not supported with HTML entrypoints; use --outdir","messagePattern":"--output is not supported with HTML entrypoints; use --outdir","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/bundle/mod.rs","lineNumber":153,"sourceCode":"    let graph = plugin_handler.module_graph_container.graph();\n    let mut fully_resolved_roots = IndexSet::with_capacity(graph.roots.len());\n    for root in &graph.roots {\n      fully_resolved_roots.insert(graph.resolve(root).clone());\n    }\n    *plugin_handler.resolved_roots.write() = Arc::new(fully_resolved_roots);\n\n    Ok(BundlerInput::Entrypoints(\n      roots.into_iter().map(|e| (\"\".into(), e.into())).collect(),\n    ))\n  } else {\n    // require an outdir when any HTML is present\n    if bundle_flags.output_dir.is_none() {\n      return Err(deno_core::anyhow::anyhow!(\n        \"--outdir is required when bundling HTML entrypoints\",\n      ));\n    }\n    if bundle_flags.output_path.is_some() {\n      return Err(deno_core::anyhow::anyhow!(\n        \"--output is not supported with HTML entrypoints; use --outdir\",\n      ));\n    }\n\n    // Prepare HTML pages and temp entry modules\n    let mut html_pages = Vec::new();\n    let mut to_cache_urls = Vec::new();\n    let mut entries: Vec<(String, String)> = Vec::new();\n    let virtual_modules = Arc::new(VirtualModules::new());\n\n    for html_path in &html_paths {\n      let entry = html::load_html_entrypoint(\n        init_cwd,\n        html_path,\n        plugin_handler\n          .is_runtime_api\n          .then_some(&plugin_handler.permissions),\n      )?;","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/bundle/mod.rs#L135-L171","documentation":"--output/-o names a single output file, which cannot hold the multi-file output an HTML entrypoint produces (html + js + css + maps). When any entrypoint is HTML and bundle_flags.output_path is Some, the CLI rejects the combination and points at --outdir (cli/tools/bundle/mod.rs:152-156).","triggerScenarios":"'deno bundle --output dist/app.js index.html' (or the -o short form) with an HTML entry among the inputs; build scripts reusing a JS-bundle command line against an HTML page.","commonSituations":"Porting an existing 'deno bundle -o app.js src/main.ts' pipeline to HTML entrypoints; CI configs with a hardcoded --output flag.","solutions":["Replace --output <file> with --outdir <dir>: 'deno bundle --outdir dist index.html'","If you truly need one JS file, bundle the page's script entry directly instead of the HTML"],"exampleFix":"# before\ndeno bundle --output dist/app.js index.html\n# after\ndeno bundle --outdir dist index.html","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# Reject the --output + HTML combination before spawning deno\nentry=\"$1\"; shift\ncase \"$entry\" in *.html|*.htm) case \" $* \" in *' --output '*|*' -o '*) echo 'use --outdir, not --output, for HTML entrypoints'; exit 2;; esac;; esac\ndeno bundle \"$entry\" \"$@\"","typeGuard":"function usesSingleOutput(flags: string[]): boolean {\n  return flags.includes('--output') || flags.includes('-o');\n}","tryCatchPattern":null,"preventionTips":["Migrate legacy 'deno bundle -o file.js entry.ts' commands to --outdir when adding HTML entries","Audit CI configs for hardcoded --output flags before adopting HTML bundling"],"tags":["bundle","html","cli-flags","validation"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}