From ca8c4d2bcf83513385412e9fe5b9441678afca23 Mon Sep 17 00:00:00 2001 From: themyth92 Date: Sat, 10 Oct 2020 19:56:16 +0800 Subject: [PATCH] fix: check file pattern correctly when gzip --- src/deployer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/deployer.js b/src/deployer.js index 16d4496..c6328c3 100644 --- a/src/deployer.js +++ b/src/deployer.js @@ -113,7 +113,8 @@ class Deployer { let fileKey = filename.replace(this.config.fullAssetPath, '').replace(/\\/g, '/') let fullFileKey = (`${this.config.deployPath}${fileKey}`).replace(/\/\//g, '/'); let pwaSupportForFile = this.config.options.pwa && this.config.options.pwaFiles.split(',').indexOf(fileKey) > -1 - let gzip = this.config.options.gzip && globby.sync(this.config.options.gzipFilePattern, { cwd: this.config.fullAssetPath }) + let gzipMatches = globby.sync(this.config.options.gzipFilePattern, { cwd: this.config.fullAssetPath }) + let gzip = this.config.options.gzip && gzipMatches.indexOf(fileKey) !== -1 if (gzip) { fileStream = zlib.gzipSync(fileStream, { level: 9 })