{"record":{"id":"5bcd149eb021f827","repo":"swc-project/swc","slug":"bundle-command-is-not-yet-implemented","errorCode":null,"errorMessage":"Bundle command is not yet implemented","messagePattern":"Bundle command is not yet implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_cli_impl/src/commands/bundle.rs","lineNumber":8,"sourceCode":"use clap::Parser;\n\n#[derive(Parser)]\npub struct BundleOptions {}\n\nimpl super::CommandRunner for BundleOptions {\n    fn execute(&self) -> anyhow::Result<()> {\n        unimplemented!(\"Bundle command is not yet implemented\")\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":11,"githubUrl":"https://github.com/swc-project/swc/blob/d7d74346665e36e692aa07e13d4ee3ee692ee35c/crates/swc_cli_impl/src/commands/bundle.rs#L1-L11","documentation":"The `swc` CLI (crates/swc_cli_impl, binary name `swc`) registers a `bundle` subcommand via clap, but BundleOptions::execute is a stub that calls unimplemented!() at bundle.rs:8. Running `swc bundle ...` therefore panics immediately with exit code 101. Only `compile` and `plugin` subcommands are implemented in this crate.","triggerScenarios":"Executing `swc bundle <input>` with the swc_cli_impl binary (installed from this repo / cargo install). clap parses the args fine, then Command::Bundle(options) => options.execute() panics.","commonSituations":"Users assuming the official CLI exposes the bundler the way esbuild does; scripts written against `@swc/cli` docs but executed with the native `swc` binary; CI steps failing with 'not implemented: Bundle command is not yet implemented'.","solutions":["Use the supported commands: `swc compile <files>` for transpilation, or `swc plugin --new` for plugin scaffolding.","For bundling, use another tool (esbuild, rollup, webpack) or drive swc_bundler/swc_core's Bundler from Rust/JS (`@swc/core` does not bundle; use a bundler that can consume swc's output).","If you own the binary, implement CommandRunner for BundleOptions (wire it to swc_bundler) or change the stub to return a proper anyhow error.","Track the upstream swc-cli issue for bundle support before relying on it."],"exampleFix":"# before\nswc bundle ./src/index.js -o out.js\n\n# after\nswc compile ./src/index.js -o out.js   # transpile only\n# bundle with esbuild:\nesbuild ./src/index.js --bundle --outfile=out.js","handlingStrategy":"try-catch","validationCode":"# The subcommand is listed in --help but still panics; probe in a subprocess\nswc bundle --version >/dev/null 2>&1 || true\nif ! swc --help 2>&1 | grep -q '^  compile'; then echo \"unexpected swc build\"; fi\n# authoritative check: run against a no-op input and inspect the failure\nprintf 'export {}' > /tmp/probe.js\nswc bundle /tmp/probe.js >/dev/null 2>/tmp/swc_probe.err\nif grep -q 'Bundle command is not yet implemented' /tmp/swc_probe.err; then\n  echo 'bundle is a stub in this swc build — do not use it'\nfi","typeGuard":null,"tryCatchPattern":"#!/usr/bin/env bash\nset +e\nswc bundle ./src/index.js -o out.js 2>/tmp/swc_err.txt\nstatus=$?\nset -e\nif [ \"$status\" -eq 101 ] && grep -q 'Bundle command is not yet implemented' /tmp/swc_err.txt; then\n  echo 'swc bundle unimplemented; falling back to esbuild' >&2\n  exec esbuild ./src/index.js --bundle --outfile=out.js\nfi\nexit \"$status\"","preventionTips":["Treat only `swc compile` and `swc plugin` as working subcommands of the native CLI; do not script `swc bundle`.","Wrap third-party CLI calls in a subprocess and check exit code 101 plus the panic message instead of trusting --help.","Prefer `@swc/cli` (npm) for transpilation workflows and esbuild/rollup for bundling.","Pin the swc CLI version in CI and smoke-test the exact subcommands your scripts use."],"tags":["swc","cli","bundle","unimplemented","panic","exit-101"],"backgroundTag":null,"analyzedSha":"d7d74346665e36e692aa07e13d4ee3ee692ee35c","analyzedAt":"2026-08-16T12:41:13.160Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}