{"record":{"id":"036f2bb05aef5988","repo":"DioxusLabs/dioxus","slug":"esbuild-failed-stderr","errorCode":null,"errorMessage":"esbuild failed: {stderr}","messagePattern":"esbuild failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/opt/js.rs","lineNumber":85,"sourceCode":"    }\n\n    if lexer::js_is_module(js_options, source) {\n        cmd.arg(\"--bundle\");\n        cmd.arg(\"--format=esm\");\n        // Don't try to resolve URL-based imports at build time — let the\n        // browser fetch them at runtime. Without these externals, esbuild\n        // errors out on patterns like `import x from \"https://cdn/lib.js\"`.\n        cmd.arg(\"--external:https://*\");\n        cmd.arg(\"--external:http://*\");\n    }\n\n    tracing::debug!(\"Running esbuild: {:?}\", cmd);\n\n    let output = cmd.output().context(\"Failed to run esbuild\")?;\n\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        anyhow::bail!(\"esbuild failed: {stderr}\");\n    }\n\n    Ok(())\n}\n\npub(crate) fn hash_js(\n    _js_options: &JsAssetOptions,\n    source: &Path,\n    hasher: &mut impl std::hash::Hasher,\n) -> anyhow::Result<()> {\n    hash_file_contents(source, hasher)\n}\n\npub use lexer::*;\nmod lexer {\n    //! Detect whether a JavaScript source file uses ES module syntax.\n    //!\n    //! This is a token-level scanner inspired by Guy Bedford's `es-module-lexer`","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/opt/js.rs#L67-L103","documentation":"Raised in run_esbuild (called from process_js) after spawning the esbuild binary on a JS/TS asset: the process ran but exited with a non-success status. This is an external tool failure — typically a syntax/type error in the source, an unresolvable import, or unsupported esbuild options — and esbuild's captured stderr is included to pinpoint the failing input.","triggerScenarios":"Thrown at packages/cli/src/opt/js.rs:85 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["esbuild failed. Fix the JavaScript error printed in its stderr output."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}