Skip to content

0.3.3 broken: exports.bun points to ./src/react-compiler.ts which is not in published tarball #2

Description

@lerms

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

  1. Add "src" to the files: array in package.json so the source ships in the tarball, OR
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions