aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bundler/bundle_v2.zig4
-rw-r--r--src/options.zig2
-rw-r--r--src/resolver/resolver.zig6
3 files changed, 8 insertions, 4 deletions
diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig
index b91d23d4e..8e98037d5 100644
--- a/src/bundler/bundle_v2.zig
+++ b/src/bundler/bundle_v2.zig
@@ -388,8 +388,8 @@ pub const BundleV2 = struct {
_ = package_bundle_map;
var generator = try allocator.create(BundleV2);
- bundler.options.mark_bun_builtins_as_external = bundler.options.platform.isBun();
- bundler.resolver.opts.mark_bun_builtins_as_external = bundler.options.platform.isBun();
+ bundler.options.mark_builtins_as_external = bundler.options.platform.isBun() or bundler.options.platform == .node;
+ bundler.resolver.opts.mark_builtins_as_external = bundler.options.platform.isBun() or bundler.options.platform == .node;
var this = generator;
diff --git a/src/options.zig b/src/options.zig
index 93603018a..ca5acd793 100644
--- a/src/options.zig
+++ b/src/options.zig
@@ -1340,7 +1340,7 @@ pub const BundleOptions = struct {
allow_runtime: bool = true,
trim_unused_imports: ?bool = null,
- mark_bun_builtins_as_external: bool = false,
+ mark_builtins_as_external: bool = false,
react_server_components: bool = false,
react_server_components_boundary: string = "",
hot_module_reloading: bool = false,
diff --git a/src/resolver/resolver.zig b/src/resolver/resolver.zig
index 21d09ecbb..0d24d2e39 100644
--- a/src/resolver/resolver.zig
+++ b/src/resolver/resolver.zig
@@ -561,7 +561,11 @@ pub const Resolver = struct {
}
pub fn isExternalPattern(r: *ThisResolver, import_path: string) bool {
- if (r.opts.mark_bun_builtins_as_external) {
+ if (r.opts.mark_builtins_as_external) {
+ if (strings.hasPrefixComptime(import_path, "node:") or strings.hasPrefixComptime(import_path, "bun:")) {
+ return true;
+ }
+
if (bun.JSC.HardcodedModule.Aliases.has(import_path)) {
return true;
}