From 5e9ac572b46e0b1ddd9a60f1ff327f0ffb5ed777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 13 Dec 2024 02:35:58 +0800 Subject: [PATCH] feat: detect native typescript support on node --- src/detect.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/detect.ts b/src/detect.ts index 0184c9f..c963eca 100644 --- a/src/detect.ts +++ b/src/detect.ts @@ -79,6 +79,11 @@ let _isNativeTsImportSupported: boolean | undefined export async function isNativeTsImportSupported(): Promise { if (_isNativeTsImportSupported === undefined) { + // @ts-expect-error missing `typescript` property + // eslint-disable-next-line node/prefer-global/process + if (typeof process !== 'undefined' && process.features?.typescript) { + return _isNativeTsImportSupported = true + } try { const modName = 'dummy.mts' const mod = await import(`../runtime-fixtures/${modName}`)