-
Notifications
You must be signed in to change notification settings - Fork 693
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
Add gzip support? #460
Comments
Having support for the |
Yes, the |
When we added Serve to Create React App's default suggestion after the build, we assumed it will keep its behavior of gzipping assets by default. Otherwise it creates a confusing impression that React is 100 KB already gzipped (since we suggest to test the "production build" with Serve). |
@gaearon This is a good's suggestion. And It's is better that make response status code is 304, now every response status is always 200. |
New to gzipp-ing but I think I am seeing the same issue: Visual example, (gzipped the file circled is 37 KB) If I g-zip the files manually it will return a 404. Hopefully, I am commenting in the correct location. Happy to move the comment elsewhere. I was able to have the compression after manually compressing and using express-static-gzip Happy to provide an example or additional info. |
It's not a proper server for production without supporting gzip :-( |
Serving gzip-ed files require making extra filesystem calls. My thoughts are probably it can be implemented through the middleware here we only need a stream. Something hacky like this would work. createReadStream = async (absolutePath, config) => {
if (config.start || config.end) {
// probably don't handle range requests
return fs.createReadStream(absolutePath, config);
}
try {
// stat gz and br files
const stats = await fs.stat(`${absolutePath}.gz`);
if (stats) {
return fs.createReadStream(`${absolutePath}.gz`);
} else {
throw new Error('Stat fail');
}
} catch (err) {
return fs.createReadStream(absolutePath, config);
}
} And we can't just ignore this
|
Added in #487. |
Thanks @leo, |
What steps are needed to reproduce? @lmf-git When I checked this morning, I was at first shocked, then I realized that I had chrome extensions turned on that were making some of the network requests. When I switched to incognito mode. Everything was gzipped. My example uses vanilla create react app since it is quick to spin up. Running the build and then serving the build locally using serve. |
I have this statically exported app on vercel https://modern-dbt-docs-omega.vercel.app/source/source.gitlab_snowflake.zoominfo.global and you can see in the network panel the |
|
I am also having the same issue on Pingdom with Vercel and NextJS |
I noticed in #11 that you added gzip support two years ago.
However, I tried reading the source code and I find nothing related to compression.
When using
serve -s build
for my react application, there is no compression occuring and I receive the file as-is. I have.js.gz
files along my.js
files so I expectedserve
to use those but it doesn't happen.Why was that feature removed? Would it be possible to put it back?
The text was updated successfully, but these errors were encountered: