Closed joyfulelement closed 1 year ago
Hello - thanks for raising this issue. As I noted in the release notes for v2.1.0, I am also encountering this issue. Not quite sure why, I think it is a problem with Astro. I am still investigating, and will update if I find any solutions. If you have any ideas, let me know.
I've traced the problem to the following line:
const posts = await getCollection('blog')
This is just a vanilla call to grab a list of blog posts in Astro v2 and it works in build but not dev. There is no easy workaround, but I will investigate further.
For what it's worth, Release v1.1.0 does not have this problem, only the v2.x releases which use content collection.
I have now submitted a bug report to astro documenting this issue: https://github.com/withastro/astro/issues/6173
Looks like we did encountered a real issue with circular dependencies when calling getCollection()
, thanks for digging through this and raise it to the astro team.
I've traced the problem to the following line:
const posts = await getCollection('blog')
This is just a vanilla call to grab a list of blog posts in Astro v2 and it works in build but not dev. There is no easy workaround, but I will investigate further.
For what it's worth, Release v1.1.0 does not have this problem, only the v2.x releases which use content collection.
May I know how you manage to trace back to this line of code? Is there certain mode to run yarn run dev
that can give us the pointers to help troubleshoot astro when it hangs like this? My browser wasn't loading anything so devTool wasn't helpful.
May I know how you manage to trace back to this line of code? Is there certain mode to run
yarn run dev
that can give us the pointers to help troubleshoot astro when it hangs like this? My browser wasn't loading anything so devTool wasn't helpful.
LOL I just did it the old school way, I kept commenting out blocks until I found the problem. I was suspecting getCollection
from the start, so it didn't take long.
This issue is now resolved with Release v2.3.0 - astro dev works again.
Can you confirm this is the case?
This issue is now resolved with Release v2.3.0 - astro dev works again.
Can you confirm this is the case?
Confirmed release v2.3.0 with astro dev
working again. Thanks!
Hi, thanks for the creation of the astro template, I had a chance to try running this with
yarn run dev
, but the site does not load from http://localhost:3000/hello-astro/The Issue
If I try the root path, it will return the expected 404 page:
However, if I navigate to http://localhost:3000/hello-astro/ it will just keep loading indefinitely with no response:
Other Findings
yarn build
+yarn preview
works flawlessly 🎉Was there any other steps needed before running
yarn run dev
? Any guidance would be much appreciated, thank you.