Skip to content

Commit

Permalink
fix(eval): return fallback value (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro authored Oct 7, 2024
1 parent c1a24e0 commit dccce59
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function evalModule(
ctx: Context,
source: string,
evalOptions: EvalModuleOptions = {},
) {
): any {
// Resolve options
const id =
evalOptions.id ||
Expand Down Expand Up @@ -74,7 +74,10 @@ export function evalModule(
).catch((error: any) => {
debug(ctx, "Native import error:", error);
debug(ctx, "[fallback]", filename);
evalModule(ctx, source, { ...evalOptions, forceTranspile: true });
return evalModule(ctx, source, {
...evalOptions,
forceTranspile: true,
});
});
} else {
try {
Expand Down

0 comments on commit dccce59

Please sign in to comment.