Compress when building
See original GitHub issueAs a part of npm run build
, can I also compress in addition to minifying?
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Compression - Designing Buildings Wiki
Simple compression is a common phenomenon in building structures as all loads and forces have eventually to be directed into the ground. Thus, ......
Read more >What Is Compression Force? - MT Copeland
Compression is a factor in all buildings, since loads and forces eventually have to be directed into the ground. It is also a...
Read more >Tension and Compression Forces in Buildings. - YouTube
Two key types of forces involved in buildings or any other structure are tension and compression. Every material has the ability to hold...
Read more >Schedule Compression Tactics to Refine Schedules Already ...
Many of them apply to acceleration before construction begins. Using building information modeling or fast-tracking a project during the design ...
Read more >Pressure Vessel Software For ASME VIII - Codeware Inc.
COMPRESS automates jobs that less capable solutions require you to do. Tasks such as compiling reports, determining MDMT chart assignments, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Something like this should work for you, right?
Cloudfront, the CDN based on S3 by Amazon compresses for you. By looking at our analytics, 5% of users do not accept gzip as a valid encoding right now in prod for our websites.
This was surprising to me. Right now this guides people towards shooting themselves in the foot, especially with the deployment recommendations in the README and in Heroku’s docs. There are two other issues about it (https://github.com/facebookincubator/create-react-app/issues/3169 and https://github.com/facebookincubator/create-react-app/issues/1117) with folks saying this is unexpected as well.
Worse, the output from the
build
task implies that the assets are gzip compressed when they aren’t (added in https://github.com/facebookincubator/create-react-app/pull/2648):One option could be to update the docs to recommend gzipping, and updating the docs for each deployment option recommended in the README.
Another option could be to add in https://github.com/webpack-contrib/compression-webpack-plugin to https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/config/webpack.config.prod.js#L263 so that
yarn run build
produces both the plain and gzipped artifacts. The downside to adding this by default is that it adds time to the production build for folks who don’t want gzipped assets. This seems like a good tradeoff - folks following the README and docs forcreate-react-app
get gzipped assets in production by default, while increasing production build times for people who handle gzipping some other way. This also seems in line with thecreate-react-app
philosophy to help teach and nudge folks towards learning best practices, and add sensible defaults that helps them avoid common mistakes.Folks have mentioned that it’s common for gzipping to be done on-the-fly by the webserver. FWIW, in my experience I haven’t seen this in practice and compressing at build time has been more common. If folks adding recommended deployment options to the
create-react-app
docs missed this, then it’s probably a place where a default could be helpful 😃@gaearon mentioned being open to pull requests in https://github.com/facebookincubator/create-react-app/issues/1117#issuecomment-313855881, I’m happy to add in https://github.com/webpack-contrib/compression-webpack-plugin if folks are open to it.