File size: 410 Bytes
4e23b01
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export async function resolve(specifier, context, nextResolve) {
  try {
    return await nextResolve(specifier, context);
  } catch (error) {
    if (
      error?.code === 'ERR_MODULE_NOT_FOUND' &&
      (specifier.startsWith('./') || specifier.startsWith('../')) &&
      /\.m?js$/.test(specifier)
    ) {
      return nextResolve(specifier.replace(/\.m?js$/, '.ts'), context);
    }
    throw error;
  }
}