{"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":"exception","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/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/bundle/mod.rs#L135-L171","documentation":"`deno bundle` rejects the combination of `--output` (a single output path) with HTML entrypoints. HTML bundling emits multiple files into a directory (JS with content hash, `.js.map`, patched HTML), so a single output path cannot represent the result; the error tells you to use `--outdir` instead.","triggerScenarios":"`deno bundle --output=app.js index.html` — any run with at least one HTML entrypoint plus the `--output` flag.","commonSituations":"Build scripts ported from JS bundling that hard-code `--output`; muscle memory from esbuild's `--outfile` flag.","solutions":["Replace `--output` with `--outdir`: `deno bundle --outdir=dist index.html`","If a single JS file is genuinely required, bundle the script module directly and keep HTML out of the entrypoints"],"exampleFix":"# before\ndeno bundle --output=app.js index.html\n\n# after\ndeno bundle --outdir=dist index.html","handlingStrategy":"validation","validationCode":"// Wrapper: reject --output when any entry ends with .html\nconst entries = Deno.args.filter((a) => !a.startsWith(\"-\"));\nif (\n  entries.some((e) => e.endsWith(\".html\")) &&\n  Deno.args.some((a) => a.startsWith(\"--output\") || a === \"-o\")\n) {\n  throw new Error(\"use --outdir, not --output, when bundling HTML\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Map HTML bundles to --outdir in all build scripts","Reserve --output for single-file JS bundles"],"tags":["bundle","html","cli-flags","conflicting-flags"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}