mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
When multiple files in a bundle import from the same external module
(e.g., `react/jsx-dev-runtime`), the bundler now merges them into a
single import statement with all unique named imports.
Before:
```js
// a.js
import { jsxDEV } from "react/jsx-dev-runtime";
// index.js
import { jsxDEV as jsxDEV2, Fragment } from "react/jsx-dev-runtime";
```
After:
```js
import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
```
The fix:
1. Merges symbol refs across files so they all point to a canonical
symbol for each (path, import name) pair
2. Augments the first import statement for each path to include all
unique imports from all files
3. Removes duplicate import statements from subsequent files
Fixes #3029
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>