starlight: Breaks after Astro updates to 5.0.3

What version of starlight are you using?

0.29.2

What version of astro are you using?

5.0.3

What package manager are you using?

pnpm

What operating system are you using?

Linux

What browser are you using?

Firefox

Describe the Bug

Astro asked me to update to version 5. So I did:

pnpm dlx @astrojs/upgrade

 astro   Integration upgrade in progress.

      ◼  @astrojs/check is up to date on v0.9.4
      ◼  @astrojs/sitemap is up to date on v3.2.1
      ●  @astrojs/starlight will be updated to v0.29.2
      ▲  astro will be updated to  v5.0.3 

  wait   One package has breaking changes. Continue?
         Yes

 check   Be sure to follow the CHANGELOG.
         astro Upgrade to Astro v5

 ██████  Installing dependencies with pnpm...

╭─────╮  Houston:
│ ◠ ◡ ◠  Have fun building!
╰─────╯

…which I immediately regretted…

npx astro dev            
16:58:46 [vite] (ssr) Error when evaluating SSR module /home/chaas/projekte/ispmail-astro/workaround/astro.config.mjs:
|- Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './jsx/renderer.js' is not defined by "exports" in /home/chaas/projekte/ispmail-astro/workaround/node_modules/.pnpm/@astrojs+mdx@3.1.8_astro@5.0.3_rollup@4.24.0_typescript@5.6.3_yaml@2.6.0_/node_modules/astro/package.json imported from /home/chaas/projekte/ispmail-astro/workaround/node_modules/.pnpm/@astrojs+mdx@3.1.8_astro@5.0.3_rollup@4.24.0_typescript@5.6.3_yaml@2.6.0_/node_modules/@astrojs/mdx/dist/index.js
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:662:9)
    at packageResolve (node:internal/modules/esm/resolve:842:14)
    at moduleResolve (node:internal/modules/esm/resolve:926:18)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:654:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:586:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:135:49)

[astro] Unable to load your Astro config

Package subpath './jsx/renderer.js' is not defined by "exports" in /home/chaas/projekte/ispmail-astro/workaround/node_modules/.pnpm/@astrojs+mdx@3.1.8_astro@5.0.3_rollup@4.24.0_typescript@5.6.3_yaml@2.6.0_/node_modules/astro/package.json imported from /home/chaas/projekte/ispmail-astro/workaround/node_modules/.pnpm/@astrojs+mdx@3.1.8_astro@5.0.3_rollup@4.24.0_typescript@5.6.3_yaml@2.6.0_/node_modules/@astrojs/mdx/dist/index.js
  Stack trace:
    at exportsNotFound (node:internal/modules/esm/resolve:314:10)
    at packageResolve (node:internal/modules/esm/resolve:842:14)
    at defaultResolve (node:internal/modules/esm/resolve:1056:11)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:603:25)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:242:38)

Link to Minimal Reproducible Example

https://github.com/Signum/starlight-astro5-breakage

Participation

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Support for Astro v5 has been released in Starlight v0.30.0. Thanks for your patience.

As a temporary fix, add this to your package.json:

"overrides": {
  "@astrojs/mdx": "^4.0.0"
}

Thanks @morellodev , after removing the node_modules and use your configuration, works fine now. Thanks!

Starlight with @astrojs/starlight-tailwind still breaks with the same error.

That appears to be a different error from any of the ones shared above. A new issue with a reproduction would be the best way to share this.

The work around is fine for me, if you use pnpm you need to edit the package.json as follows (reference here):

"pnpm": {
  "overrides": {
    "@astrojs/mdx": "^4.0.0"
  }
}

and then re-run pnpm install. This should fix the issue!