feat(es/config): Accept jsc.experimental.keepImportAssertions (#7995)

**Related issue:**

 - Closes #7923.
This commit is contained in:
Donny/강동윤 2023-09-24 00:47:30 +09:00 committed by GitHub
parent 3eb23eba7b
commit 4d777ee270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 1 deletions

View File

@ -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)]

View File

@ -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
}

View File

@ -0,0 +1,3 @@
import packageJSON from "./package.json" assert { type: "json" };
console.log(packageJSON)

View File

@ -0,0 +1,4 @@
import packageJSON from "./package.json" assert {
type: "json"
};
console.log(packageJSON);