Skip to content

Commit

Permalink
feat(es/config): Accept jsc.experimental.keepImportAssertions (swc-…
Browse files Browse the repository at this point in the history
…project#7995)

**Related issue:**

 - Closes swc-project#7923.
  • Loading branch information
kdy1 authored Sep 23, 2023
1 parent 3eb23eb commit 4d777ee
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/swc/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ pub struct JscExperimental {
#[serde(default)]
pub plugins: Option<Vec<PluginConfig>>,
/// If true, keeps import assertions in the output.
#[serde(default)]
#[serde(default, alias = "keepImportAssertions")]
pub keep_import_attributes: BoolConfig<false>,

#[serde(default)]
Expand Down
17 changes: 17 additions & 0 deletions crates/swc/tests/fixture/issues-7xxx/7908/input/3/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript"
},
"target": "es2022",
"experimental": {
"keepImportAssertions": true,
"emitAssertForImportAttributes": true
}
},
"module": {
"type": "es6"
},
"isModule": true
}
3 changes: 3 additions & 0 deletions crates/swc/tests/fixture/issues-7xxx/7908/input/3/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import packageJSON from "./package.json" assert { type: "json" };

console.log(packageJSON)
4 changes: 4 additions & 0 deletions crates/swc/tests/fixture/issues-7xxx/7908/output/3/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import packageJSON from "./package.json" assert {
type: "json"
};
console.log(packageJSON);

0 comments on commit 4d777ee

Please sign in to comment.