From 722b4842ea2414b7f304128bbff9ea9db1cc7c28 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Mon, 27 Jan 2025 14:29:52 +0100 Subject: [PATCH] fix: check undefined format --- src/strip-loader.ts | 2 +- src/transform-loader.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strip-loader.ts b/src/strip-loader.ts index 151ee2083..99d2502b1 100644 --- a/src/strip-loader.ts +++ b/src/strip-loader.ts @@ -11,7 +11,7 @@ export async function load( ) => LoadFnOutput | Promise, ) { const { format } = context; - if (format.endsWith("-typescript")) { + if (format?.endsWith("-typescript")) { // Use format 'module' so it returns the source as-is, without stripping the types. // Format 'commonjs' would not return the source for historical reasons. try { diff --git a/src/transform-loader.ts b/src/transform-loader.ts index 89b786d8e..688a07fd4 100644 --- a/src/transform-loader.ts +++ b/src/transform-loader.ts @@ -12,7 +12,7 @@ export async function load( ) => LoadFnOutput | Promise, ) { const { format } = context; - if (format.endsWith("-typescript")) { + if (format?.endsWith("-typescript")) { try { // Use format 'module' so it returns the source as-is, without stripping the types. // Format 'commonjs' would not return the source for historical reasons.