withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.26k stars 2.44k forks source link

The `trailingSlash: “ignore”` configuration does not work in the `public/` directory in the dev environment #11209

Closed CosmoLau closed 4 months ago

CosmoLau commented 4 months ago

Astro Info

Astro                    v4.10.0
Node                     v20.14.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @swup/astro
                         astro-icon
                         astro-compress
                         @astrojs/svelte
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I want to put static sites generated by other frameworks in the public/ directory, but the trailingSlash: “ignore” configuration does not work in the public/ directory in the dev environment. So I have to add /index.html to access pages in the public/ directory.

The project is fine after the build, this only happens in dev environments.

What's the expected result?

The trailingSlash: “ignore” configuration is also supported for the public/ directory in dev environments.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-i3ueaq-ywej2r?file=src%2Fpages%2Findex.astro

Participation

matthewp commented 4 months ago

You can also have HTML in the src/pages/ folder. Did you try that? We don't do routing in the public/ folder which is why you aren't seeing it work the way you'd like.

CosmoLau commented 4 months ago

You can also have HTML in the src/pages/ folder. Did you try that? We don't do routing in the public/ folder which is why you aren't seeing it work the way you'd like.

The content I want to put in the public/ directory is not just a simple HTML file, if I put it in src/pages/ it warns me Unsupported file type D:\**\settings.json found. Prefix filename with an Prefix filename with an underscore (_) to ignore. and it won't run.

How do I ignore an entire folder in src/pages/ without changing the filename?

matthewp commented 4 months ago

Well you would just put the pages in src/pages/*.html, all non-pages leave in public.