Skip to content

Commit 23389ce

Browse files
authored
cleaner
1 parent 114331b commit 23389ce

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

src/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,11 @@ export function register(serviceOrOpts: Service | RegisterOptions | undefined):
547547

548548
Module.registerHooks({
549549
load(url, context, nextLoad) {
550-
if (url.endsWith('.ts') && context.format === null) {
551-
require(fileURLToPath(url));
552-
return {
553-
format: 'commonjs',
554-
source: '',
555-
shortCircuit: true,
556-
};
557-
}
558-
if (context.format === 'commonjs-typescript' && !urls[url]) {
550+
const isTypeScript =
551+
(url.endsWith('.ts') && context.format === null) ||
552+
(context.format === 'commonjs-typescript');
553+
554+
if (isTypeScript && !urls[url]) {
559555
urls[url] = true;
560556

561557
require(fileURLToPath(url));

0 commit comments

Comments
 (0)