swc-project/swc · error · SyntaxError
The requested module '{specifier}' does not provide an expor
Error message
The requested module '{specifier}' does not provide an export named '{export_name}' What it means
Error "The requested module '{specifier}' does not provide an export named '{export_name}'" thrown in swc-project/swc.
Source
Thrown at bindings/binding_nodejs_support_wasm/src/nodejs.rs:590
fn await_import(
code: &str,
specifier: &str,
with: Option<&ObjectLit>,
required_exports: &[String],
) -> String {
let mut out = format!("{DYNAMIC_IMPORT_NAME}({}", json_string(specifier));
if let Some(options) = import_options_to_dynamic_options(code, with) {
out.push_str(", ");
out.push_str(&options);
}
out.push(')');
if !required_exports.is_empty() {
out.push_str(".then((m) => { ");
for export_name in required_exports {
out.push_str("if (!(");
out.push_str(&json_string(export_name));
out.push_str(" in m)) throw new SyntaxError(");
out.push_str(&json_string(&format!(
"The requested module '{specifier}' does not provide an export named \
'{export_name}'"
)));
out.push_str("); ");
}
out.push_str("return m; })");
}
out
}
fn import_options_to_dynamic_options(code: &str, with: Option<&ObjectLit>) -> Option<String> {
let attributes = slice_span(code, with?.span)?;
Some(format!("{{ with: {attributes} }}"))
}
fn default_declaration_needs_parentheses(decl: &DefaultDecl) -> bool {
matches!(decl, DefaultDecl::Class(class) if class.ident.is_none())View on GitHub (pinned to d7d7434666)
When it happens
Trigger: Thrown at bindings/binding_nodejs_support_wasm/src/nodejs.rs:590 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@d7d7434666 (2026-08-16).
Data as JSON: /api/errors/6098a50bbbe768d1.
Report an issue: GitHub.