diff --git a/Dockerfile.ops-web b/Dockerfile.ops-web index 61ef5bd..3fb54ce 100644 --- a/Dockerfile.ops-web +++ b/Dockerfile.ops-web @@ -8,6 +8,7 @@ RUN npm install -g pnpm@10.33.0 WORKDIR /app COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ +COPY packages/tsconfig/base.json ./packages/tsconfig/base.json COPY apps/ops-web/package.json ./apps/ops-web/ RUN pnpm install --frozen-lockfile diff --git a/apps/ops-web/nginx.conf b/apps/ops-web/nginx.conf index 9016e1d..e50288e 100644 --- a/apps/ops-web/nginx.conf +++ b/apps/ops-web/nginx.conf @@ -24,4 +24,9 @@ server { expires 1y; add_header Cache-Control "public, immutable"; } + + gzip on; + gzip_static on; + gzip_vary on; + gzip_types text/plain text/css application/json application/javascript text/xml; } diff --git a/apps/ops-web/package.json b/apps/ops-web/package.json index 870486e..211cb22 100644 --- a/apps/ops-web/package.json +++ b/apps/ops-web/package.json @@ -25,6 +25,7 @@ "@vitejs/plugin-vue": "^6.0.5", "typescript": "^5.9.3", "vite": "^7.3.2", + "vite-plugin-compression2": "^2.5.3", "vue-tsc": "^3.2.6" } } diff --git a/apps/ops-web/vite.config.ts b/apps/ops-web/vite.config.ts index f9623e5..90d9530 100644 --- a/apps/ops-web/vite.config.ts +++ b/apps/ops-web/vite.config.ts @@ -1,16 +1,27 @@ import { fileURLToPath, URL } from "node:url"; import vue from "@vitejs/plugin-vue"; -import { defineConfig, loadEnv } from "vite"; +import { defineConfig, loadEnv, type PluginOption } from "vite"; +import { compression } from "vite-plugin-compression2"; const r = (path: string) => fileURLToPath(new URL(path, import.meta.url)); export default defineConfig(({ mode }) => { const env = loadEnv(mode, ".", ""); const isProd = mode === "production"; + const plugins: PluginOption[] = [vue()]; + + if (isProd) { + plugins.push( + compression({ + algorithms: ["gzip", "brotliCompress"], + threshold: 1024, + }), + ); + } return { - plugins: [vue()], + plugins, resolve: { alias: { "@": r("./src"), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2cf63eb..1eceac9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -254,6 +254,9 @@ importers: vite: specifier: ^7.3.2 version: 7.3.2(@types/node@24.12.0)(jiti@2.6.1)(lightningcss@1.32.0) + vite-plugin-compression2: + specifier: ^2.5.3 + version: 2.5.3(rollup@4.60.2) vue-tsc: specifier: ^3.2.6 version: 3.2.6(typescript@5.9.3)