Skip to content

Commit

Permalink
feat: detect native typescript support on node (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Dec 13, 2024
1 parent dffade0 commit ae3dea0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/detect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ let _isNativeTsImportSupported: boolean | undefined

export async function isNativeTsImportSupported(): Promise<boolean> {
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}`)
Expand Down

0 comments on commit ae3dea0

Please sign in to comment.