diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index 88652f205..611754475 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -805,15 +805,15 @@ impl<'a, const MINIFY: bool> Gen for ExportAllDeclaration<'a> { if self.is_typescript_syntax() { return; } - p.print_str(b"export"); + p.print_str(b"export "); p.print(b'*'); if let Some(exported) = &self.exported { - p.print_str(b"as "); + p.print_str(b" as "); exported.gen(p, ctx); } - p.print_str(b" from"); + p.print_str(b" from "); self.source.gen(p, ctx); self.with_clause.gen(p, ctx); diff --git a/crates/oxc_codegen/tests/mod.rs b/crates/oxc_codegen/tests/mod.rs index b25faf4e3..84cf15246 100644 --- a/crates/oxc_codegen/tests/mod.rs +++ b/crates/oxc_codegen/tests/mod.rs @@ -100,3 +100,8 @@ fn template() { test("new tag()`${x}`", "new tag()`${x}`;\n"); test("(new tag)`${x}`", "new tag()`${x}`;\n"); } + +#[test] +fn module_decl() { + test("export * as foo from 'foo'", "export * as foo from 'foo';\n"); +}