Skip to content

Commit ff4b302

Browse files
committed
fix: set allowSyntheticDefaultImports properly
Fixes #4156
1 parent 083cd89 commit ff4b302

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

src/legacy/compiler/__snapshots__/ts-compiler.spec.ts.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ exports[`TsCompiler getCompiledOutput isolatedModules false should compile codes
1818

1919
exports[`TsCompiler getCompiledOutput isolatedModules false should compile codes with useESM {"babelConfig": false, "supportsStaticESM": true, "useESM": true} 1`] = `
2020
{
21-
"allowSyntheticDefaultImports": true,
21+
"allowSyntheticDefaultImports": undefined,
2222
"esModuleInterop": true,
2323
"module": 1,
2424
}
@@ -50,7 +50,7 @@ exports[`TsCompiler getCompiledOutput isolatedModules true should transpile code
5050

5151
exports[`TsCompiler getCompiledOutput isolatedModules true should transpile code with config {"babelConfig": false, "supportsStaticESM": true, "useESM": true} 1`] = `
5252
{
53-
"allowSyntheticDefaultImports": true,
53+
"allowSyntheticDefaultImports": undefined,
5454
"esModuleInterop": true,
5555
"module": 1,
5656
}

src/legacy/compiler/ts-compiler.ts

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ export class TsCompiler implements TsCompilerInstance {
172172
...compilerOptions,
173173
module: moduleKind,
174174
esModuleInterop: esModuleInterop ?? false,
175-
allowSyntheticDefaultImports: esModuleInterop ?? compilerOptions.allowSyntheticDefaultImports,
176175
}
177176
}
178177

src/legacy/config/config-set.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ describe('parsedTsConfig', () => {
9797

9898
expect(cs.parsedTsConfig.options).toMatchObject({
9999
module: ts.ModuleKind.AMD,
100-
allowSyntheticDefaultImports: true,
101100
esModuleInterop: false,
102101
})
103102
expect(target.lines.warn.join()).toEqual(expect.stringContaining(Errors.ConfigNoModuleInterop))
@@ -839,7 +838,6 @@ describe('_resolveTsConfig', () => {
839838
expect(readConfig.mock.calls[0][0]).toBe(tscfgPathStub)
840839
expect(parseConfig.mock.calls[0][2]).toBe('/root')
841840
expect(parseConfig.mock.calls[0][4]).toBe(tscfgPathStub)
842-
expect(conf.options.allowSyntheticDefaultImports).toEqual(true)
843841
expect(conf.errors).toMatchSnapshot()
844842
})
845843

src/legacy/config/config-set.ts

-5
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,6 @@ export class ConfigSet {
487487
start: undefined,
488488
length: undefined,
489489
})
490-
// at least enable synthetic default imports (except if it's set in the input config)
491-
/* istanbul ignore next (already covered in unit test) */
492-
if (!('allowSyntheticDefaultImports' in finalOptions)) {
493-
finalOptions.allowSyntheticDefaultImports = true
494-
}
495490
}
496491
// Make sure when allowJs is enabled, outDir is required to have when using allowJs: true
497492
if (finalOptions.allowJs && !finalOptions.outDir) {

0 commit comments

Comments
 (0)