aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bundler.zig4
-rw-r--r--src/js_parser/js_parser.zig5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bundler.zig b/src/bundler.zig
index b73dfbb78..c5e736498 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -2635,7 +2635,9 @@ pub const Bundler = struct {
bundler.macro_context = js_ast.Macro.MacroContext.init(bundler);
}
- opts.features.top_level_await = bundler.options.platform.isBun();
+ // we'll just always enable top-level await
+ // this is incorrect for Node.js files which are modules
+ opts.features.top_level_await = true;
opts.macro_context = &bundler.macro_context.?;
opts.macro_context.remap = this_parse.macro_remappings;
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index 809a97e26..356f040b2 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -15427,7 +15427,10 @@ pub fn NewParser(
this.require_transposer = @TypeOf(this.require_transposer).init(this);
this.require_resolve_transposer = @TypeOf(this.require_resolve_transposer).init(this);
- if (opts.features.top_level_await) this.fn_or_arrow_data_parse.allow_await = .allow_expr;
+ if (opts.features.top_level_await) {
+ this.fn_or_arrow_data_parse.allow_await = .allow_expr;
+ this.fn_or_arrow_data_parse.is_top_level = true;
+ }
}
};
}