withastro / starlight

🌟 Build beautiful, accessible, high-performance documentation websites with Astro
https://starlight.astro.build
MIT License
5.03k stars 532 forks source link

Can't build starlight docs #2432

Closed MoinJulian closed 1 month ago

MoinJulian commented 1 month ago

What version of starlight are you using?

^0.28.2

What version of astro are you using?

^4.15.3

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

Chrome

Describe the Bug

When trying to run pnpm build, which runs astro check and asto build the build fails at some point. When having an existing dist folder the check fail, throwing 14 error and hundreds of warnings all coming from the dist folder.

When deleting the dist folder, the command fails with this error: The requested module 'nanoid/non-secure' does not provide an export named 'default'

Which I am not even using because I just have some .md files and it happens even in an empty project using pnpm create astro --template starlight.

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/starlight/tree/main/examples/markdoc?on=stackblitz

Participation

HiDeoo commented 1 month ago

Thanks for the feedback.

I think there are 2 issues here, the first one being the warnings that are displayed when running pnpm build (which at the moment runs astro check && astro build) with an existing dist folder. This is a known behavior that can be fixed by adding "exclude": ["dist"] to the tsconfig.json file until changed upstream.

Regarding the second error: The requested module 'nanoid/non-secure' does not provide an export named 'default':

Could you confirm you're also seeing this error in the provided Stackblitz link?

MoinJulian commented 1 month ago

I could fix the dist error thank you.

You were correct the stackblitz link does not throw that error I am sorry.

After creating a new astro starlight project in an empty folder which was not in a monorepo and transferring all the code into the monorepo folder it mysteriously run the build command without any issues.

Thank you for your help.

HiDeoo commented 1 month ago

Happy to hear, thanks for following up.