Skip to content

Commit 797f698

Browse files
authored
Merge pull request #264 from prgrms-web-devcourse-final-project/refacto/263-text-compression
[refacto]: 텍스트 압축 설정
2 parents d885fff + 332920c commit 797f698

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

package-lock.json

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"typescript": "~5.7.2",
5353
"typescript-eslint": "^8.22.0",
5454
"vite": "^6.1.0",
55+
"vite-plugin-compression": "^0.5.1",
5556
"vite-plugin-pwa": "^0.21.1"
5657
}
5758
}

vite.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react';
33
import { VitePWA } from 'vite-plugin-pwa';
44
import tailwindcss from '@tailwindcss/vite';
55
import { fileURLToPath, URL } from 'url';
6+
import compression from 'vite-plugin-compression';
67

78
// https://vite.dev/config/
89

@@ -15,6 +16,16 @@ export default defineConfig(({ mode }) => {
1516
global: 'window', // global을 window로 설정
1617
},
1718
plugins: [
19+
compression({
20+
algorithm: 'brotliCompress', // Brotli 적용
21+
threshold: 1024, // 1KB 이상만 압축
22+
ext: '.br', // Brotli 확장자 사용
23+
}),
24+
compression({
25+
algorithm: 'gzip', // Gzip도 적용 (백업용)
26+
threshold: 1024, // 1KB 이상만 압축
27+
ext: '.gz',
28+
}),
1829
react(),
1930
tailwindcss(),
2031
VitePWA({

0 commit comments

Comments
 (0)