astro icon indicating copy to clipboard operation
astro copied to clipboard

🐛 BUG: Having an `index` file in a client loaded component causes Vercel to serve the wrong content

Open maggie-j-liu opened this issue 2 years ago • 2 comments

What version of astro are you using?

1.0.0-beta.63

Are you using an SSR adapter? If so, which one?

Vercel

What package manager are you using?

pnpm

What operating system are you using?

Mac

Describe the Bug

I have a component in src/components/Test/index.astro, and when using the client:load prop, the code gets outputted in index.008427c3.js in Vercel (see source and output here: https://vercel.com/maggieliu/astro-vercel/4zPaiARbkPcbM57zKUcZBPkG7p9K/source).

Since the adapter uses handle: 'filesystem', which according to Vercel's docs means to

check matches after the filesystem misses

the index.008427c3.js file is served instead of invoking the render serverless function. Example here: https://astro-vercel-rloz589ce-maggieliu.vercel.app/

Link to Minimal Reproducible Example

https://github.com/maggie-j-liu/astro-vercel

Participation

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

maggie-j-liu avatar Jul 03 '22 01:07 maggie-j-liu

Hey @maggie-j-liu thanks for opening an issue!

One quick workaround I can think of: you can customize output filenames to avoid this issue.

Since you're potentially willing to contribute, do you have any ideas on how we could fix this problem for folks automatically?

natemoo-re avatar Jul 08 '22 16:07 natemoo-re

Hi! Thanks for the workaround! I'm not really sure how to fix it automatically since I'm not too familiar with how the internals of Astro work, but if you have any ideas I could try to take a look at the code.

maggie-j-liu avatar Jul 08 '22 17:07 maggie-j-liu