Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output all immutable files into common directory #1364

Open
teodragovic opened this issue Aug 4, 2020 · 2 comments
Open

Output all immutable files into common directory #1364

teodragovic opened this issue Aug 4, 2020 · 2 comments

Comments

@teodragovic
Copy link
Contributor

Do you want to request a feature or report a bug?

Feature

What is the current behaviour?

All webpack-generated files are outputted into build directory alongside files from static, index.html and manifest.json that are copied verbatim.

If this is a feature request, what is motivation or use case for changing the behaviour?

CRA has heuristic that all hash-based, immutable files are placed in static/ directory. Generated files that should not be cached like sw are NOT part of this directory. This makes writing server caching rules easier.

IMO it would be great if the same or similar setup could be provided by preact-cli.

@benkingcode
Copy link

I've also just run into this problem, deploying to Vercel and trying to set cache headers for immutable files, but they're not colocated so have had to resort to some funky regexing.

@teodragovic
Copy link
Contributor Author

FYI this is the current caching solution my team uses:

ALL files have Cache-Control: max-age=0, must-revalidate, public header set along with ETag and Last Modified. This makes sure files are cached but always re-validated against origin server before use.

Reference: https://www.netlify.com/blog/2017/02/23/better-living-through-caching/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants