vue、react配置gzip打包后,删除源文件deleteOriginalAssets: true,nginx需要的配置

1、删除源文件后,配置了gzip,当配置gzip删除源文件后,解决前端history问题,就会出现所有的都返回html,请求js、css也会返回html,页面会报错,如下配置即可

 location / {
            root   e:/build;
            index  index.html index.htm;
            gzip_static on; #查找静态文件
            try_files $uri $uri/ /index.html; #找不到返回html,处理前端history路由模式
        }
          #静态文件交给nginx处理
        location ~* \.(jpg|jpeg|png|gif|css|js|swf|mp3|avi|flv|xml|zip|rar)$ {
            root e:/build;
            gzip_static on;
        }