Skip to content

astro preview fails silently with missing dist folder #9297

@hirasso

Description

@hirasso

Astro Info

Astro                    v3.6.4
Node                     v18.19.0
System                   macOS (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             astro-expressive-code
                         @astrojs/mdx

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):

astro preview --root docs

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 and astro preview isn't the same as astro preview alone.

Link to Minimal Reproducible Example

n/a

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: nice to haveNot breaking anything but nice to have (priority)help wantedPlease help with this issue!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions