Symptom
Installing bun-plugin-react-compiler@0.3.3 and importing it under Bun fails:
error: Cannot find package 'bun-plugin-react-compiler' from /path/to/build-bun.ts
0.3.2 works fine. 0.3.3 does not.
Root cause
package.json in 0.3.3 declares:
"exports": {
".": {
"bun": "./src/react-compiler.ts",
"default": "./dist/react-compiler.js"
}
}
But files: ["dist"] only ships dist/ to npm — src/ is not in the published tarball. Bun resolves the bun condition first, points at ./src/react-compiler.ts, the file isn't there, and the import fails.
Confirm with:
curl -s https://registry.npmjs.org/bun-plugin-react-compiler/-/bun-plugin-react-compiler-0.3.3.tgz | tar tzf -
Output:
package/package.json
package/README.md
package/dist/react-compiler.d.ts
package/dist/react-compiler.js
No src/.
Repro
mkdir /tmp/repro && cd /tmp/repro
bun init --yes
bun add bun-plugin-react-compiler@0.3.3
echo 'import x from "bun-plugin-react-compiler"; console.log(x)' > test.ts
bun run test.ts
# error: Cannot find package 'bun-plugin-react-compiler' from .../test.ts
0.3.2 doesn't have this issue — its exports map points directly at ./dist/react-compiler.js with no bun condition.
Suggested fixes
- Add
"src" to the files: array in package.json so the source ships in the tarball, OR
- Drop the
bun condition entirely and have exports.bun resolve to ./dist/react-compiler.js like default.
Option 2 is simpler and matches 0.3.2's behavior — Bun runs the compiled JS just fine. Option 1 only matters if the goal is to give Bun users TS source for sourcemap fidelity, which would also need "src" in files.
Workaround
Pinning to 0.3.2 until this is fixed.
Symptom
Installing
bun-plugin-react-compiler@0.3.3and importing it under Bun fails:0.3.2 works fine. 0.3.3 does not.
Root cause
package.jsonin 0.3.3 declares:But
files: ["dist"]only shipsdist/to npm —src/is not in the published tarball. Bun resolves thebuncondition first, points at./src/react-compiler.ts, the file isn't there, and the import fails.Confirm with:
curl -s https://registry.npmjs.org/bun-plugin-react-compiler/-/bun-plugin-react-compiler-0.3.3.tgz | tar tzf -Output:
No
src/.Repro
0.3.2 doesn't have this issue — its
exportsmap points directly at./dist/react-compiler.jswith nobuncondition.Suggested fixes
"src"to thefiles:array inpackage.jsonso the source ships in the tarball, ORbuncondition entirely and haveexports.bunresolve to./dist/react-compiler.jslikedefault.Option 2 is simpler and matches 0.3.2's behavior — Bun runs the compiled JS just fine. Option 1 only matters if the goal is to give Bun users TS source for sourcemap fidelity, which would also need
"src"infiles.Workaround
Pinning to
0.3.2until this is fixed.