(specifier, context, nextResolve)
| 1 | export async function resolve(specifier, context, nextResolve) { |
| 2 | try { |
| 3 | return await nextResolve(specifier, context) |
| 4 | } catch (error) { |
| 5 | if (!shouldRetryWithTypeScriptExtension(specifier, error)) throw error |
| 6 | return nextResolve(`${specifier}.ts`, context) |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | function shouldRetryWithTypeScriptExtension(specifier, error) { |
| 11 | return error?.code === 'ERR_MODULE_NOT_FOUND' |