-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
astro preview
fails silently with missing dist
folder
#9297
Comments
Does a minimal reproducible example make sense here? I'd say my package is as minimal as it gets 😄. It contains an astro site, a playwright test suite and a github action to run the tests. |
This seems like a general question, so a reproduction is not necessary. Although our discord server is where queries similar to yours would get a faster response: https://astro.build/chat. To answer the question: no, |
Oh my god. That's why it was working locally. The build folder was already there 🤪 Thanks for the quick reply! |
...revisiting the docs I must confess that it didn't make it fully clear to me that |
Awesome! Thanks for the help. |
I just tested running ❯ npx astro preview --root docs
🚀 astro v3.6.4 started in 14ms
┃ Local http://localhost:8274/
┃ Network use --host to expose ...and in the browser I get a 404: @lilnasy I think some kind of warning in the console (or even in the browser?) would be helpful here. If you agree, should I create a feature request? |
astro preview
breaks PlayWright webServer in CIastro preview
not warning about missing dist
folder
astro preview
not warning about missing dist
folderastro preview
fails silently with missing dist
folder
Yes, this is something new users frequently encounter. So if you contribute a warning, it will really help! We are planning to show the list of all routes on the 404 page in the dev server, we will probably tackle the same for preview server as well. For now, a warning about dist being empty would be valuable. |
Do we want to show a warning here or a no preview message because no dist (like we do for adapters like Vercel), @lilnasy? |
I think a warning/message that bails like Vercel (because it doesn't support the preview command) works for me. So technically speaking, around this code: astro/packages/astro/src/core/preview/index.ts Lines 34 to 45 in 270c6cc
We could also simply throw an error for consistency. I don't think there's a case where we still want to start the preview server. |
I'd also like it to fail with an error. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
Hi there! I'm really not sure if this is a problem with Astro, PlayWright's
webServer
or GitHub actions 😅I have a little package where I create the docs with Astro and also use the same docs to test my package through PlayWright (see the config). This is what I tried first for PlayWright's
webServer.command
(contrived example, actually the commands are in npm scripts to make sure they are being run from the root of my package):It was working nicely locally, but as soon as I put it in a GitHub action, playWright was hanging indefinitely.
What's the expected result?
The PlayWright tests should be able to resolve the provided server (created by
astro preview
)Turns out first building Astro before serving the preview fixed my issue in CI:
astro build --root docs && astro preview --root docs
Now I'm curious: What's the difference here? Doesn't
astro preview
also build the astro site?There is a related thread over at PlayWright and I'll happily close this issue if the astro maintainers think this is an issue with PlayWright. But then I'd still love to learn why combining
astro build
andastro preview
isn't the same asastro preview
alone.Link to Minimal Reproducible Example
n/a
Participation
The text was updated successfully, but these errors were encountered: