Open azat-io opened 2 months ago
Seems like one of Vite's middleware is taking a higher priority than Astro's when handling the request, in which Vite will serve the file from the fs as-is, but we should probably takeover and match the routing first.
I don't know if something has changed, but I can't reproduce the issue with your Stackblitz. I click on "open page" and it shows "OK". I've downloaded and run it locally and it's the same. This is what I get for both:
Could you check the repro and see if it's still happening for you?
Whoa, this is a fun one. I can reproduce it in Chrome but it works fine in Firefox.
Perhaps Chrome/Firefox is sending additional request headers that affect how the middleware works 🤔
I'm having real trouble reproducing this. I can't get reproduce it locally at all, and Stackblitz is really hard to debug network-wise. It seems to be intermittent even in Chrome. It works fine a lot of the time.
Are you able to reproduce this anywhere except Stackblitz, because I can't?
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Any browser
Describe the Bug
I have a specific project structure. This project is an ESLint plugin.
For this reason, I configure
srcDir
in the Astro config.However, if the path inside
srcDir
matches the path in the project root, Astro renders the contents of the TypeScript file in development mode.I created a project to reproduce the problem: https://stackblitz.com/edit/withastro-astro-bjf3yl?file=posts%2Ftest.ts,astro.config.mjs,docs%2Fpages%2Fposts%2F[...slug].astro
Open project and click "open page" to see the problem.
In my example, I expect to see the contents of
docs/content/posts/test.md
, not the contents ofposts/test.ts
.The problem is only reproduced in development mode. And only if the path does not have a trailing slash.
What's the expected result?
I expect Astro to render the contents of the Markdown file, not the TypeScript file, which is not in
srcDir
at all.Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-bjf3yl?file=posts%2Ftest.ts,astro.config.mjs,docs%2Fpages%2Fposts%2F[...slug].astro
Participation