feat: support multiple staticDir entries (#3759)

## Summary
- `staticDir` now accepts `string | string[]` in both the **Vite
plugin** (`FreshViteConfig`) and the **Builder API** (`BuildOptions`)
- When multiple directories are specified, they are searched in order
and the first match wins
- **Vite plugin**: first dir maps to Vite's native `publicDir`; extra
dirs are served manually in the dev server and walked during production
builds
- **Builder API**: both `MemoryBuildCache` (dev) and `DiskBuildCache`
(prod) iterate over all directories
- Updated tailwind v3 plugin to use `config.root` instead of
`path.dirname(config.staticDir)`
- Docs updated: `static-files.md`, `vite.md`, `builder.md`

Closes #3105

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bartek Iwańczuk
2026-04-09 07:49:32 +00:00
committed by GitHub
co-authored by Claude Opus 4.6
parent c0a866d027
commit 990aeb03f3
13 changed files with 320 additions and 95 deletions
+4
View File
@@ -27,6 +27,10 @@ export default defineConfig({
islandsDir: "./islands",
// Path to routes directory. Default: ./routes
routeDir: "./routes",
// Static file directory or directories. Default: "static"
// When multiple directories are given, they are searched in
// order and the first match wins.
staticDir: ["static", "generated"],
// Optional regex to ignore folders when crawling the routes and
// island directory.
ignore: [/[\\/]+some-folder[\\/]+/],