我准备了所有设置(在我家,Windows 10)来创建和js作为gz文件,但仍然 - 我只获得常规js文件(原始大小).
组态
- Angular的webpack文件:
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
})
Run Code Online (Sandbox Code Playgroud)
- 该配置的输出文件:
- Index.html文件:
...
<body>
<app-root>Loading...</app-root>
<script src="/dist/polyfills.bundle.js"></script>
<script src="/dist/main.bundle.js"></script>
</body>
...
Run Code Online (Sandbox Code Playgroud)
诊断
当我导航到http://kkk.com/index.html,我得到完整大小的文件:
另外 - 查看请求标头,我发送Accept-Encoding:gzip, deflate 标头:
题
为什么不提供GZ文件?
附加信息 :