diff options
author | 2022-06-22 06:46:32 -0700 | |
---|---|---|
committer | 2022-06-22 06:56:47 -0700 | |
commit | 150f33c6fac5f217d349573f59a6b5f690b4c161 (patch) | |
tree | ae74c286e8762e06b67cabee91146f5214b886b0 | |
parent | 56aec17b9bfc3998ef7ba3f6b85e74cc1acbe60e (diff) | |
download | bun-150f33c6fac5f217d349573f59a6b5f690b4c161.tar.gz bun-150f33c6fac5f217d349573f59a6b5f690b4c161.tar.zst bun-150f33c6fac5f217d349573f59a6b5f690b4c161.zip |
Disable modules constently for bun in`bun bun`
-rw-r--r-- | src/bundler/generate_node_modules_bundle.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bundler/generate_node_modules_bundle.zig b/src/bundler/generate_node_modules_bundle.zig index 21902f9d9..d8f615144 100644 --- a/src/bundler/generate_node_modules_bundle.zig +++ b/src/bundler/generate_node_modules_bundle.zig @@ -57,6 +57,7 @@ const EntryPoints = @import("./entry_points.zig"); const BunQueue = sync.Channel(PendingImports, .Dynamic); const GenerateNodeModuleBundle = @This(); const ThisBundler = @import("../bundler.zig").Bundler; +const JSC = @import("javascript_core"); pub const ThreadPool = struct { pool: ThreadPoolLib = undefined, // Hardcode 512 as max number of threads for now. @@ -1317,6 +1318,14 @@ pub fn processFile(this: *GenerateNodeModuleBundle, worker: *ThreadPool.Worker, continue; } + if (bundler.options.platform.isBun()) { + if (JSC.DisabledModule.has(import_record.path.text)) { + import_record.path.is_disabled = true; + import_record.is_bundled = true; + continue; + } + } + if (bundler.resolver.resolve(source_dir, import_record.path.text, import_record.kind)) |*_resolved_import| { if (_resolved_import.is_external) { continue; @@ -1728,6 +1737,13 @@ pub fn processFile(this: *GenerateNodeModuleBundle, worker: *ThreadPool.Worker, continue; } + if (bundler.options.platform.isBun()) { + if (JSC.DisabledModule.has(import_record.path.text)) { + import_record.path.is_disabled = true; + continue; + } + } + if (bundler.resolver.resolve(source_dir, import_record.path.text, import_record.kind)) |*_resolved_import| { if (_resolved_import.is_external) { continue; |