Skip to content

JavaScript not being bundled in production build for components #8018

@lorenzolewis

Description

@lorenzolewis

What version of astro are you using?

2.10.4

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Safari

Describe the Bug

Reproduction Steps

  1. Setup an .mdx file in Starlight
  2. Use <Tabs> and <TabItem> components within that file
  3. Create a new custom component and import that within the aforementioned .mdx file
  4. Run pnpm build && pnpm preview (I'll come back to why not to use pnpm dev in a bit)
  5. Notice that the tabs are clickable and work as expected
  6. Within that newly created custom component import Starlight's <Icon> component (essentially using this custom component as a wrapper). (Note: there doesn't seem to be any special issues with the <Icon> component from what I can tell, this is able to be reproduced with other imported components as well)
  7. Now run pnpm build && pnpm preview again. You will notice those tab items are no longer clickable.

Notes

Files to pay attention to the repro

What's the expected result?

The <Tab> components and their respective JS should be included in the production build

Link to Minimal Reproducible Example

https://github.com/lorenzolewis/starlight-component-bug

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions