swc-project/swc · error

module string names unimplemented

Error message

module string names unimplemented

What it means

An unimplemented!() in wrap_esm of the bundler's computed-key pass (computed_key.rs:74). While handling injected `export *` re-exports from dependency modules (the deno#9200 workaround path), a specifier whose original name is a string literal (ModuleExportName::Str) instead of an identifier reaches a case with no implementation, so the pass aborts. The string-named export specifier in the injected export list is the input at fault.

Solutions

  1. Implement ModuleExportName::Str handling for injected re-exports in the ESM wrap pass
  2. Avoid string export names in code destined for the bundler
  3. Skip (with a warning) string-named re-exports that cannot be represented instead of aborting the bundle
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/swc_bundler/src/bundler/chunk/computed_key.rs:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/01ad3e9d83f3b70b. Report an issue: GitHub.

Appendix: source

Thrown at crates/swc_bundler/src/bundler/chunk/computed_key.rs:74

                // Handle `export *`-s from dependency modules.
                //
                // See: https://github.com/denoland/deno/issues/9200
                ModuleItem::ModuleDecl(ModuleDecl::ExportNamed(NamedExport {
                    ref specifiers,
                    with: Some(with),
                    ..
                })) if is_injected(with) => {
                    for s in specifiers {
                        if let ExportSpecifier::Named(ExportNamedSpecifier {
                            orig,
                            exported: Some(exported),
                            ..
                        }) = s
                        {
                            let exported = match exported {
                                ModuleExportName::Ident(ident) => ident,
                                ModuleExportName::Str(..) => {
                                    unimplemented!("module string names unimplemented")
                                }
                                #[cfg(swc_ast_unknown)]
                                _ => panic!("unable to access unknown nodes"),
                            };
                            if ctx.transitive_remap.get(&exported.ctxt).is_some() {
                                let specifier = ExportSpecifier::Named(ExportNamedSpecifier {
                                    span: DUMMY_SP,
                                    orig: orig.clone(),
                                    exported: Some(ModuleExportName::Ident(exported.clone())),
                                    is_type_only: false,
                                });
                                additional_items.push((
                                    module_id,
                                    NamedExport {
                                        span: DUMMY_SP,
                                        specifiers: vec![specifier],
                                        src: None,
                                        type_only: false,

View on GitHub (pinned to 5176682b65)