Skip to content

Commit 8564f88

Browse files
sxzzprivatenumber
andauthored
fix: default moduleResolution for module: preserve (#90)
Co-authored-by: Hiroki Osame <[email protected]>
1 parent 9c49320 commit 8564f88

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/parse-tsconfig/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ const normalizeCompilerOptions = (
291291

292292
if (target === 'esnext') {
293293
compilerOptions.module ??= 'es6';
294-
compilerOptions.moduleResolution ??= 'classic';
295294
compilerOptions.useDefineForClassFields ??= true;
296295
}
297296

@@ -308,7 +307,6 @@ const normalizeCompilerOptions = (
308307
|| target === 'es2024'
309308
) {
310309
compilerOptions.module ??= 'es6';
311-
compilerOptions.moduleResolution ??= 'classic';
312310
}
313311

314312
if (

tests/specs/parse-tsconfig/parses.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,24 @@ export default testSuite(({ describe }) => {
9393
expect(expectedTsconfig).toStrictEqual(parsedTsconfig);
9494
});
9595

96+
test('implicit config', async () => {
97+
await using fixture = await createFixture({
98+
'file.ts': '',
99+
'tsconfig.json': createTsconfigJson({
100+
compilerOptions: {
101+
target: 'es2022',
102+
module: 'preserve',
103+
},
104+
}),
105+
});
106+
107+
const parsedTsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
108+
const expectedTsconfig = await getTscTsconfig(fixture.path);
109+
delete expectedTsconfig.files;
110+
111+
expect(expectedTsconfig).toStrictEqual(parsedTsconfig);
112+
});
113+
96114
describe('baseUrl', ({ test }) => {
97115
test('relative path', async () => {
98116
await using fixture = await createFixture({

0 commit comments

Comments
 (0)