aboutsummaryrefslogtreecommitdiff
path: root/src/js_parser
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-03-01 22:16:09 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-03-01 22:16:09 -0800
commit2ccb063d206cf26037db4df42f813e207fe9ca13 (patch)
tree576a6903bfe3c0eb962836cd19fba6f3d48e1b88 /src/js_parser
parent710303be7ae12302193be3ce90da2eec61f4203e (diff)
downloadbun-2ccb063d206cf26037db4df42f813e207fe9ca13.tar.gz
bun-2ccb063d206cf26037db4df42f813e207fe9ca13.tar.zst
bun-2ccb063d206cf26037db4df42f813e207fe9ca13.zip
[bun.js] Allow disabling runtime imports so bun can build for node
Diffstat (limited to 'src/js_parser')
-rw-r--r--src/js_parser/js_parser.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/js_parser/js_parser.zig b/src/js_parser/js_parser.zig
index 236e3b0a5..358ae165a 100644
--- a/src/js_parser/js_parser.zig
+++ b/src/js_parser/js_parser.zig
@@ -2742,7 +2742,10 @@ pub const Parser = struct {
// - don't import runtime if we're bundling, it's already included
// - when HMR is enabled, we always need to import the runtime for HMRClient and HMRModule.
// - when HMR is not enabled, we only need any runtime imports if we're importing require()
- if (!p.options.enable_bundling and (p.has_called_runtime or p.options.features.hot_module_reloading or has_cjs_imports)) {
+ if (p.options.features.allow_runtime and
+ !p.options.enable_bundling and
+ (p.has_called_runtime or p.options.features.hot_module_reloading or has_cjs_imports))
+ {
const before_start = before.items.len;
if (p.options.features.hot_module_reloading) p.resolveHMRSymbols();
@@ -15928,7 +15931,7 @@ fn NewParser_(
logger.Loc.Empty,
);
part.stmts = new_stmts_list;
- } else if (p.options.features.hot_module_reloading) {
+ } else if (p.options.features.hot_module_reloading and p.options.features.allow_runtime) {
var named_exports_count: usize = p.named_exports.count();
const named_imports: js_ast.Ast.NamedImports = p.named_imports;