Comments (8)
Just in case some one else find this issue later.
If you are using html-webpack-plugin
along side compression-webpack-plugin
and you want the html-webpack-plugin
to reference the .gz file automatically.
You can try this plugin: html-webpack-change-assets-extension-plugin.
Eg:
plugins: [
new HtmlWebpackPlugin({
jsExtension: ".gz"
}),
new CompressionPlugin(), // compression plugin will generate the xxx.js.gz file
new HtmlWebpackChangeAssetsExtensionPlugin()
];
from compression-webpack-plugin.
@akashbiz
You need to set an appropriate header, metadata, for the objects that are gzip compressed, either using the CLI or manually adjusting each object in the web console. Example using CLI:
$ aws s3 sync . s3://bucketName --content-encoding gzip --metadata-directive REPLACE
Btw, you don't need to have both .gz and non-gzipped objects at the same time. AWS S3 uncompresses the objects by itself before responding to the request, if the client's browser doesn't support GZIP. It's also explained in the AWS S3 docs.
from compression-webpack-plugin.
If you use html-webpack-plugin
, it's a bug/known issue (#71), otherwise compression-webpack-plugin
doesn't alter anything by itself here and you need to do it manually
from compression-webpack-plugin.
Yes, I have gone through that issue, but even after changing in index.html manually, in browser its loading entire content within gz file.
My main.bundle.js was 1.1 MB initially without use of compression plugin, after using compression it became 286KB and saved on my local. When I deploy this build on aws s3, it shows 1.1MB transferred for this gzip file in browser dev tools. Also, its not showing the content-encoding as gzip.
Any idea what am I doing wrong?
from compression-webpack-plugin.
Also, If I update .gz extension manually to bundle files still in browser its not showing content-encoding: gzip, Content-Length is also not visible. So is there any other setting required to add these content-encoding as gzip so that browser can download only 286KB and unzip them in browser?
from compression-webpack-plugin.
This needs to be configured in your 'webserver' config separately (send with the correct content-encoding
header). No idea how to enable it for AWS sry :)
from compression-webpack-plugin.
@OlzhasAlexandrov Thx 👍
from compression-webpack-plugin.
@o-alexandrov
Hi, I'm glad that I found your comment, it helped me solve the problem of serving gzipped static assets directly from S3 (especially webpack chunks).
AWS S3 uncompresses the objects by itself before responding to the request, if the client's browser doesn't support GZIP.
With regards to on-the-fly gzip decompression, I was wondering if you could provide any reference to the page that documents this behavior or some way to test it - I tried googling, but the ones I found were talking about CloudFront's automatic compression feature instead. Thanks
from compression-webpack-plugin.
Related Issues (20)
- Getting error TS1005: '?' expected HOT 2
- Always 404, I don't know why, HOT 2
- gzipped css not updated in html file HOT 19
- compress images not work HOT 2
- TypeError: Cannot read properties of undefined (reading 'tapPromise') HOT 1
- Allow usage of 6.x version without md4 HOT 4
- ERROR in Conflict: Multiple assets emit different content to the same filename css/.gz HOT 1
- Restoring failed for CompressionWebpackPlugin; HookWebpackError: this._obj.updateHash is not a function HOT 5
- Some of the files ignored during build compression HOT 10
- How to do this compression from express? HOT 1
- How to use deleteOriginalAssets is true ? HOT 2
- Compressed build now working on browser HOT 6
- Version 6 (for Webpack 4) does not work on Node 18+ HOT 10
- Let users exclude files or folder from deleting original assets. HOT 1
- Compression-webpack-plugin running before HtmlCriticalWebpackPlugin completes. HOT 2
- Ability to exclude files from deletion after zipping. HOT 1
- Type definition `BasePluginOptions` property `test` should use `Rules`, not `Rule`
- compression-webpack-plugin .woff compression is not supported HOT 3
- Bug: `deleteOriginalAssets: true` removes the `.js.LICENSE.txt` files HOT 3
- Bug: `deleteOrigianlAssets: true` breaks the build badly... HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compression-webpack-plugin.