swc-project/swc · error
Bundle command is not yet implemented
Error message
Bundle command is not yet implemented
What it means
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.
Source
Thrown at crates/swc_cli_impl/src/commands/bundle.rs:8
use clap::Parser;
#[derive(Parser)]
pub struct BundleOptions {}
impl super::CommandRunner for BundleOptions {
fn execute(&self) -> anyhow::Result<()> {
unimplemented!("Bundle command is not yet implemented")
}
}
View on GitHub (pinned to d7d7434666)
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.
Example fix
# before swc bundle ./src/index.js -o out.js # after swc compile ./src/index.js -o out.js # transpile only # bundle with esbuild: esbuild ./src/index.js --bundle --outfile=out.js
Defensive patterns
Strategy: try-catch
Validate before calling
# The subcommand is listed in --help but still panics; probe in a subprocess
swc bundle --version >/dev/null 2>&1 || true
if ! swc --help 2>&1 | grep -q '^ compile'; then echo "unexpected swc build"; fi
# authoritative check: run against a no-op input and inspect the failure
printf 'export {}' > /tmp/probe.js
swc bundle /tmp/probe.js >/dev/null 2>/tmp/swc_probe.err
if grep -q 'Bundle command is not yet implemented' /tmp/swc_probe.err; then
echo 'bundle is a stub in this swc build — do not use it'
fi Try / catch
#!/usr/bin/env bash set +e swc bundle ./src/index.js -o out.js 2>/tmp/swc_err.txt status=$? set -e if [ "$status" -eq 101 ] && grep -q 'Bundle command is not yet implemented' /tmp/swc_err.txt; then echo 'swc bundle unimplemented; falling back to esbuild' >&2 exec esbuild ./src/index.js --bundle --outfile=out.js fi exit "$status"
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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'.
Related errors
- Lint command is not yet implemented
- Minify command is not yet implemented
- module string names unimplemented
- module string names unimplemented
- module string names unimplemented
AI-assisted analysis of swc-project/swc@d7d7434666 (2026-08-16).
Data as JSON: /api/errors/5bcd149eb021f827.
Report an issue: GitHub.