diff options
author | 2023-07-23 03:57:30 -0700 | |
---|---|---|
committer | 2023-07-23 03:58:10 -0700 | |
commit | c76516fa38ccd537be4840cdc430ffb18349b0f9 (patch) | |
tree | b0c0a37ff5421d96b2107ff222602d360ebf4e5c | |
parent | ce77266cc5884000643befcaac7f8334c0b25495 (diff) | |
download | bun-c76516fa38ccd537be4840cdc430ffb18349b0f9.tar.gz bun-c76516fa38ccd537be4840cdc430ffb18349b0f9.tar.zst bun-c76516fa38ccd537be4840cdc430ffb18349b0f9.zip |
Fixes #3764
-rw-r--r-- | src/bundler/bundle_v2.zig | 6 | ||||
-rw-r--r-- | test/bundler/bundler_edgecase.test.ts | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/bundler/bundle_v2.zig b/src/bundler/bundle_v2.zig index b70bac229..bb6ac6d8a 100644 --- a/src/bundler/bundle_v2.zig +++ b/src/bundler/bundle_v2.zig @@ -398,6 +398,12 @@ pub const BundleV2 = struct { import_record.source_index = Index.invalid; break; } + + // Handle redirects to a builtin or external module + // https://github.com/oven-sh/bun/issues/3764 + if (!other_source.isValid()) { + break; + } } v.visit(import_record.source_index, check_dynamic_imports and import_record.kind == .dynamic, check_dynamic_imports); diff --git a/test/bundler/bundler_edgecase.test.ts b/test/bundler/bundler_edgecase.test.ts index bbbe4270b..de2482907 100644 --- a/test/bundler/bundler_edgecase.test.ts +++ b/test/bundler/bundler_edgecase.test.ts @@ -21,6 +21,24 @@ describe("bundler", () => { stdout: "object", }, }); + itBundled("edgecase/NestedRedirectToABuiltin", { + files: { + "/entry.js": /* js */ ` + import * as path from './module.cjs'; + console.log(path.join('a', 'b')) + `, + "/module.cjs": /* js */ ` + module.exports = require('./2nd') + `, + "/2nd.js": /* js */ ` + module.exports = require('path') + `, + }, + target: "bun", + run: { + stdout: "a/b", + }, + }); itBundled("edgecase/ImportStarFunction", { files: { "/entry.js": /* js */ ` |