Skip to content

Barrel exports can be undefined in dev & prod builds #28166

@bensaufley

Description

@bensaufley

What version of Bun is running?

1.3.11-canary.1+d50ab984c

What platform is your computer?

Darwin 25.3.0 arm64 arm

What steps can reproduce the bug?

A sort of follow-up to #27860. Repro is here: https://github.com/bensaufley/bun-module-issue-minimal-repro/tree/chakra-example

  1. Install Chakra UI and CLI
  2. chakra add snippet for toaster and provider
  3. Add Provider and Toaster components to React UI
  4. Run dev server
  5. Visit dev server in browser

Other ways to encounter this are to use Chakra's namespaced component imports - for example, import { Tooltip } from '@chakra-ui/react'; and then use <Tooltip.Root> etc.

What is the expected behavior?

Page renders normally

What do you see instead?

Runtime Error: You are trying to create a style element with an undefined component

Runtime Error: You are trying to create a style element with an undefined component

Additional information

Chakra's use of barrel exports/namespaced imports is a code style I don't personally love, but it's common enough and should absolutely work. I can get around most of it by using non-namespaced imports, but toaster actually uses chakra library code that uses namespaced imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions