HiDeoo / starlight-blog

Starlight plugin to add a blog to your documentation
https://starlight-blog-docs.vercel.app
MIT License
126 stars 17 forks source link

Wrong module #10

Closed Ranily57 closed 1 year ago

Ranily57 commented 1 year ago

Describe the bug

Starlight Astro get his Page.astro in "Layout" and not "Layouts"

To Reproduce

  1. I tried to build
  2. i get this error: [commonjs--resolver] Missing "./layouts/Page.astro" specifier in "@astrojs/starlight" package

Expected behavior

I expect to the website to build

How often does this bug happen?

Every time

System Info

No response

Additional Context

Here is the code i saw

starlight.d.ts

declare module '@astrojs/starlight/layouts/Page.astro' {
  export default function Page(props: Record<string, unknown>): unknown
}

idk where else it is but when i change the path, i keep getting the error

HiDeoo commented 1 year ago

Good catch on that invalid path.

I have just published a new version fixing it altho I don't think it should have an impact due to the hacky Vite shenanigans that this integration is doing (which may be why the prod example is building fine, my local repo is building fine too and I also tried setting up a new project and installing the extension and it worked too).

Could you give this new version a try and see if it fixes the issue for you for some reasons I don't understand yet 🤔

Ranily57 commented 1 year ago

Still having the same error, here is the check i did:

image

I saw this on my Visual Studio Code, it's the _Page.astro from your module, and it looks like he don't find the file, but as i said, i verified the path and it's good

I tried too with another file like astro.config.mjs image

It work, no error so i feel like it's from the module but for no reason he do not find it

HiDeoo commented 1 year ago

Is your project available publicly or would you be able to push a repro to GitHub so I can take a look?

Ranily57 commented 1 year ago

Yes sure you can get on the Repo it's on the dev branch, the master one is for preview and the main one for production.

HiDeoo commented 1 year ago

Hmmm, this works for me. Could you try deleting the .astro directory you have locally and building again?

Ranily57 commented 1 year ago

Still the same error 🤔 image

I do reinstall the node_module but still break

HiDeoo commented 1 year ago

Weird that a fresh clone + git switch dev + pnpm i + pnpm build works for me 🤔 For sanity, could you try a fresh clone in a new directory even tho I don't think it would fix anything.

The only idea I have left is looking at your screenshot, you seem to be on Windows so maybe it could be OS related even tho I don't have any idea why right now and don't have any Windows machine at the moment to test it.

Ranily57 commented 1 year ago

Still having the same error image

I don't really understand what is the trouble 🤔 Windows never did this before and it's only when i installed the blog module. I'll try it on linux and i'll tell you if i get the same trouble

Ranily57 commented 1 year ago

Allright it's Windows, so it's not the module 👍

image

I'll check maybe how to solve this issue to keep working on windows on my repo. Thank's for your help, i'll continue working on the blog 😄

HiDeoo commented 1 year ago

Allright it's Windows, so it's not the module 👍

Good to know, thanks for following up. If I get the time with a Windows machine at my disposal, I'll try to see what is causing the issue.

Something to note, the Vite "hacks" that this integration is using should go away when component customization lands in Starlight so that should automatically fix the issue.

Good luck on your blog posts and documentation. When you are done and if you want, to not hesitate to add your website to the Starlight showcase.