Skip to content

Commit

Permalink
build: add vite-plugin-compression2
Browse files Browse the repository at this point in the history
 Use brotli algorithm to compress files
 Keep only compressed files in the dist folder for staging environment

Signed-off-by: Anoop N <[email protected]>
  • Loading branch information
anooparveti committed Oct 18, 2024
1 parent 5f9f457 commit 60b4eb8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/manager/core/vite-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@vitejs/plugin-react": "^2.2.0",
"express": "^4.17.1",
"http-proxy-middleware": "^1.0.4",
"vite-plugin-compression2": "^1.3.0",
"vite-plugin-svgr": "^3.2.0",
"yn": "^5.0.0"
}
Expand Down
5 changes: 5 additions & 0 deletions packages/manager/core/vite-config/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { dirname, join, resolve } from 'path';
import { fileURLToPath } from 'url';
import react from '@vitejs/plugin-react';
import legacy from '@vitejs/plugin-legacy';
import { compression } from 'vite-plugin-compression2';
import svgr from 'vite-plugin-svgr';
import yn from 'yn';

Expand Down Expand Up @@ -60,6 +61,10 @@ const getBaseConfig = (config) => {
},
plugins: [
react(),
compression({
algorithm: 'brotliCompress',
deleteOriginalAssets: true,
}),
legacy({
targets: ['defaults'],
}),
Expand Down
22 changes: 22 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6145,6 +6145,15 @@
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rollup/pluginutils@^5.1.0":
version "5.1.2"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.2.tgz#d3bc9f0fea4fd4086aaac6aa102f3fa587ce8bd9"
integrity sha512-/FIdS3PyZ39bjZlwqFnWqCOVnW7o963LtKMwQOD0NhQqw22gSr2YY1afu3FxRip4ZCZNsD5jq6Aaz6QV3D/Njw==
dependencies:
"@types/estree" "^1.0.0"
estree-walker "^2.0.2"
picomatch "^2.3.1"

"@rollup/[email protected]":
version "4.16.4"
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.16.4.tgz#5e8930291f1e5ead7fb1171d53ba5c87718de062"
Expand Down Expand Up @@ -26715,6 +26724,11 @@ tar-fs@^2.1.1:
pump "^3.0.0"
tar-stream "^2.1.4"

tar-mini@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/tar-mini/-/tar-mini-0.2.0.tgz#2b2cdc215f5b83b0ab8ce363dc9ded22de51849b"
integrity sha512-+qfUHz700DWnRutdUsxRRVZ38G1Qr27OetwaMYTdg8hcPxf46U0S1Zf76dQMWRBmusOt2ZCK5kbIaiLkoGO7WQ==

tar-stream@^1.5.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555"
Expand Down Expand Up @@ -28305,6 +28319,14 @@ [email protected]:
tinyrainbow "^1.2.0"
vite "^5.0.0"

vite-plugin-compression2@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/vite-plugin-compression2/-/vite-plugin-compression2-1.3.0.tgz#2d7a5afc4182d16498554a9cec9b366431eb3964"
integrity sha512-/cYzISoYOo/SwPUBReS1E02a8eNTpQm8+lQUBj5NNGxuq4iZ3JOfWExUlobhVhPMJuejD7dipT+cMLbaWsMbdw==
dependencies:
"@rollup/pluginutils" "^5.1.0"
tar-mini "^0.2.0"

[email protected]:
version "3.5.1"
resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-3.5.1.tgz#58c225f7ecabff2ed76027e003e1ec8ca964a078"
Expand Down

0 comments on commit 60b4eb8

Please sign in to comment.