-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the problem
When precompress: true is enabled, SvelteKit correctly generates .gz and .br files for most assets. However, plain text files (.txt) located in the static/ folder are completely ignored by the compression engine.
In production, common files like robots.txt or ads.txt are served uncompressed. For sites with strict performance requirements or those using gzip_static on in Nginx, this creates an inconsistency where these assets are either served without compression or require on-the-fly compression by the proxy, defeating the purpose of the precompress feature.
Describe the proposed solution
The pre-compression logic should be updated to include the .txt extension.
Specifically, in packages/kit/src/core/adapt/builder.js, the filter should be updated to ensure that .txt files from the static directory are picked up during the compression loop.
Since .txt files are highly compressible text-based assets, there is no technical reason to exclude them when other text formats like .xml or .svg are already included.
Alternatives considered
- Manually running a post-build shell script to gzip / brotli the .txt files in
build/client/. - Adding a third-party Vite plugin just to handle the missing .txt files, which adds unnecessary overhead to the dev stack.
Importance
nice to have
Additional Information
No response