Skip to content

Fix Bun default import handling for Babel helpers#15214

Open
gaoflow wants to merge 1 commit into
remix-run:mainfrom
gaoflow:fix-bun-babel-default-imports
Open

Fix Bun default import handling for Babel helpers#15214
gaoflow wants to merge 1 commit into
remix-run:mainfrom
gaoflow:fix-bun-babel-default-imports

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 19, 2026

Copy link
Copy Markdown

Summary

  • Handle Babel CommonJS default imports when runtimes already return the default export directly
  • Add coverage for both wrapped and already-unwrapped default import shapes
  • Add a patch change file for @react-router/dev

Fixes #15209.

AI assistance was used under my direction.

Testing

  • pnpm test packages/react-router-dev/vite/babel-test.ts packages/react-router-dev/vite/remove-exports-test.ts
  • bun --bun -e "import { generate, parse } from './packages/react-router-dev/vite/babel.ts'; const ast = parse('const x = 1', { sourceType: 'module' }); console.log(typeof generate); console.log(generate(ast).code);"
  • pnpm run --filter @react-router/dev build
  • pnpm run changes:validate
  • pnpm run --filter react-router build
  • pnpm test packages/react-router-dev/
  • pnpm run --filter @react-router/dev typecheck
  • pnpm exec prettier --check packages/react-router-dev/vite/babel.ts packages/react-router-dev/vite/babel-test.ts packages/react-router-dev/.changes/patch.bun-babel-default-imports.md
  • pnpm exec eslint packages/react-router-dev/vite/babel.ts packages/react-router-dev/vite/babel-test.ts
  • bun --bun ../../packages/react-router-dev/dist/cli/index.js typegen from playground/framework

@remix-cla-bot

remix-cla-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Hi @gaoflow,

Welcome, and thank you for contributing to React Router!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run.

Thanks!

- The Remix team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

react-router typegen (and dev/build) crash with generate is not a function when run under the Bun runtime (bun --bun / bunx --bun)

1 participant