diff --git a/src/plugins/typescript/index.ts b/src/plugins/typescript/index.ts index 57bb4886a..b390df06b 100644 --- a/src/plugins/typescript/index.ts +++ b/src/plugins/typescript/index.ts @@ -1,4 +1,3 @@ -import ts from 'typescript'; import { compact } from '../../util/array.js'; import { dirname, isInternal, toAbsolute } from '../../util/path.js'; import { timerify } from '../../util/Performance.js'; @@ -34,8 +33,6 @@ const resolveExtensibleConfig = async (configFilePath: string) => { return config; }; -const jsxWithReact = [ts.JsxEmit.React, ts.JsxEmit.ReactJSX, ts.JsxEmit.ReactJSXDev, ts.JsxEmit.ReactNative]; - export const findTypeScriptDependencies: GenericPluginCallback = async configFilePath => { const compilerOptions: CompilerOptions = await loadTSConfig(configFilePath); const config: TsConfigJson = await resolveExtensibleConfig(configFilePath); // Dual loader to get external `extends` dependencies @@ -48,11 +45,7 @@ export const findTypeScriptDependencies: GenericPluginCallback = async configFil ? compilerOptions.plugins.map(plugin => (typeof plugin === 'object' && 'name' in plugin ? plugin.name : '')) : []; const importHelpers = compilerOptions?.importHelpers ? ['tslib'] : []; - const jsx = compilerOptions?.jsxImportSource - ? [compilerOptions.jsxImportSource] - : compilerOptions?.jsx && jsxWithReact.includes(compilerOptions.jsx) - ? ['react'] - : []; + const jsx = compilerOptions?.jsxImportSource ? [compilerOptions.jsxImportSource] : []; return compact([...extend, ...types, ...plugins, ...importHelpers, ...jsx]); }; diff --git a/tests/plugins/typescript.test.ts b/tests/plugins/typescript.test.ts index 002aa6823..1f9961a43 100644 --- a/tests/plugins/typescript.test.ts +++ b/tests/plugins/typescript.test.ts @@ -25,7 +25,7 @@ test('Find dependencies in typescript configuration (jsx-preserve)', async () => test('Find dependencies in typescript configuration (jsx)', async () => { const configFilePath = join(cwd, 'tsconfig-jsx.json'); const dependencies = await typescript.findDependencies(configFilePath); - assert.deepEqual(dependencies, ['react']); + assert.deepEqual(dependencies, []); }); test('Find dependencies in typescript configuration (jsx-import-source)', async () => {