npm install --save-dev [email protected]
在config/index.js中配置:
在webpack.conf.js(或者webpack.prod.conf.js)中修改:
打包結果:
在nginx中配置:
nginx reload後如果提示沒有gz_static模塊,則需要重新編譯安裝nginx,如下:
./configure --with-http_gzip_static_module
如果之前安裝時有其他的參數設置,需要把其他的參數也帶上 ./nginx -V查看
然後make&&make install
f12查看network的請求結果是否正確