Closed HiDeoo closed 8 months ago
I just finished debugging this. It seems to be caused by the known issue that tree-shaking does not work with barrel files that (re-)export multiple components.
If your site includes any content that contains an import from @astrojs/starlight/components
(see src/content/docs/index.mdx
in the Starlight template), rollup will also try to bundle the Code
component exported from that barrel file even though it's unused, and then fail processing the virtual imports referenced by it.
I have prepared a workaround for this issue by providing shims for the virtual imports in case the user decides to set expressiveCode: false
in the config. It also includes a helpful error message if they actually try to use the <Code>
component with this config. I'll create a PR.
What version of
starlight
are you using?0.21.1
What version of
astro
are you using?4.5.6
What package manager are you using?
pnpm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Starting a new project using
pnpm create astro --template starlight
, disabling Expressive Code and trying to build fails with the following error:The only change to the starter template is the edited config to add:
The started template does not involve the
<Code>
component.cc @hippotastic
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-gcerwr?file=astro.config.mjs
Participation