fix(isolated-declarations): should emit export {} when only having ImportDeclaration (#4026)

close: #4023
This commit is contained in:
Dunqing 2024-07-02 13:47:29 +00:00
parent 7c915f4665
commit 02ea19a3b7
3 changed files with 9 additions and 1 deletions

View file

@ -317,7 +317,7 @@ impl<'a> IsolatedDeclarations<'a> {
}
}
if last_transformed_len == transformed_indexes.len() {
if !transformed_indexes.is_empty() && last_transformed_len == transformed_indexes.len() {
need_empty_export_marker = false;
}

View file

@ -0,0 +1 @@
import * as a from "mod";

View file

@ -0,0 +1,7 @@
---
source: crates/oxc_isolated_declarations/tests/mod.rs
input_file: crates/oxc_isolated_declarations/tests/fixtures/empty-export2.ts
---
==================== .D.TS ====================
export {};