From 908d9d86b347d47b90d7c80ca49586515b7218da Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 16 Dec 2021 01:30:23 -0800 Subject: [macros] Slightly improve error message if macros fail to load --- src/bundler.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/bundler.zig b/src/bundler.zig index ddcc5fd58..578e966e9 100644 --- a/src/bundler.zig +++ b/src/bundler.zig @@ -3586,8 +3586,13 @@ pub const MacroEntryPoint = struct { const code = try std.fmt.bufPrint( entry.code_buffer[macro_label.len..], \\//Auto-generated file - \\import * as Macros from '{s}{s}'; - \\ + \\var Macros; + \\try {{ + \\ Macros = await import('{s}{s}'); + \\}} catch (err) {{ + \\ console.error("Error importing macro"); + \\ throw err; + \\}} \\if (!('{s}' in Macros)) {{ \\ throw new Error("Macro '{s}' not found in '{s}{s}'"); \\}} -- cgit v1.2.3