diff options
author | 2021-12-16 01:30:23 -0800 | |
---|---|---|
committer | 2021-12-16 01:30:23 -0800 | |
commit | 908d9d86b347d47b90d7c80ca49586515b7218da (patch) | |
tree | 177d59de44c1ed476f7dcba779d3f5621551b42c | |
parent | 92f3efeac244716d8ad45000166626e06589d290 (diff) | |
download | bun-908d9d86b347d47b90d7c80ca49586515b7218da.tar.gz bun-908d9d86b347d47b90d7c80ca49586515b7218da.tar.zst bun-908d9d86b347d47b90d7c80ca49586515b7218da.zip |
[macros] Slightly improve error message if macros fail to load
-rw-r--r-- | src/bundler.zig | 9 |
1 files changed, 7 insertions, 2 deletions
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}'"); \\}} |