diff options
author | 2022-02-01 14:43:45 -0800 | |
---|---|---|
committer | 2022-02-01 14:43:45 -0800 | |
commit | 047501999dcd30eeb6da614ec62773b34ad03ae8 (patch) | |
tree | 715a16f1f8bc92908ce14b84d2c4b0c4a80ae96b | |
parent | 30f5e0d37ce0f806e6cc2509db8dce0d9a85791e (diff) | |
download | bun-047501999dcd30eeb6da614ec62773b34ad03ae8.tar.gz bun-047501999dcd30eeb6da614ec62773b34ad03ae8.tar.zst bun-047501999dcd30eeb6da614ec62773b34ad03ae8.zip |
[linker] Fix bug with multiple JSX runtimes introduced in 5922ba29acab512ff0aab51e64199d86f148c020
-rw-r--r-- | src/linker.zig | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/linker.zig b/src/linker.zig index fafd64dd2..04604522a 100644 --- a/src/linker.zig +++ b/src/linker.zig @@ -62,8 +62,11 @@ pub const Linker = struct { pub const TaggedResolution = struct { react_refresh: ?Resolver.Result = null, - jsx_import: ?Resolver.Result = null, - jsx_classic: ?Resolver.Result = null, + + // These tags cannot safely be used + // Projects may use different JSX runtimes across folders + // jsx_import: ?Resolver.Result = null, + // jsx_classic: ?Resolver.Result = null, }; pub fn init( @@ -275,16 +278,6 @@ pub const Linker = struct { var resolved_import_ = brk: { switch (import_record.tag) { else => {}, - .jsx_import => { - if (linker.tagged_resolutions.jsx_import != null) { - break :brk linker.tagged_resolutions.jsx_import.?; - } - }, - .jsx_classic => { - if (linker.tagged_resolutions.jsx_classic != null) { - break :brk linker.tagged_resolutions.jsx_classic.?; - } - }, // for fast refresh, attempt to read the version directly from the bundle instead of resolving it .react_refresh => { if (linker.options.node_modules_bundle) |node_modules_bundle| { @@ -320,14 +313,6 @@ pub const Linker = struct { if (linker.resolver.resolve(source_dir, import_record.path.text, import_record.kind)) |_resolved_import| { switch (import_record.tag) { else => {}, - .jsx_import => { - linker.tagged_resolutions.jsx_import = _resolved_import; - linker.tagged_resolutions.jsx_import.?.path_pair.primary = linker.tagged_resolutions.jsx_import.?.path().?.dupeAlloc(_global.default_allocator) catch unreachable; - }, - .jsx_classic => { - linker.tagged_resolutions.jsx_classic = _resolved_import; - linker.tagged_resolutions.jsx_classic.?.path_pair.primary = linker.tagged_resolutions.jsx_classic.?.path().?.dupeAlloc(_global.default_allocator) catch unreachable; - }, .react_refresh => { linker.tagged_resolutions.react_refresh = _resolved_import; linker.tagged_resolutions.react_refresh.?.path_pair.primary = linker.tagged_resolutions.react_refresh.?.path().?.dupeAlloc(_global.default_allocator) catch unreachable; |