Fix work recovery and reduce engine and chart overhead
Docs / docs (push) Successful in 33s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m37s
Playwright Tests / test-playwright (2, 2) (push) Failing after 27s
pre-commit / pre-commit (push) Failing after 2m37s
Test Backend / test-backend (3.12) (push) Successful in 5m7s
Test Backend / test-backend (3.14) (push) Successful in 5m2s
Compose Smoke Test / test-compose (push) Failing after 28s
Playwright Tests / merge-reports (push) Failing after 2m29s
Docs / docs (push) Successful in 33s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m37s
Playwright Tests / test-playwright (2, 2) (push) Failing after 27s
pre-commit / pre-commit (push) Failing after 2m37s
Test Backend / test-backend (3.12) (push) Successful in 5m7s
Test Backend / test-backend (3.14) (push) Successful in 5m2s
Compose Smoke Test / test-compose (push) Failing after 28s
Playwright Tests / merge-reports (push) Failing after 2m29s
This commit is contained in:
+30
-1
@@ -1,8 +1,36 @@
|
||||
import { readdir, readFile, writeFile } from "node:fs/promises"
|
||||
import path from "node:path"
|
||||
import { gzipSync } from "node:zlib"
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
import { tanstackRouter } from "@tanstack/router-plugin/vite"
|
||||
import react from "@vitejs/plugin-react-swc"
|
||||
import { defineConfig } from "vite"
|
||||
import { defineConfig, type Plugin } from "vite"
|
||||
|
||||
/** Compress once at build time, including text copied from public/. */
|
||||
function precompress(): Plugin {
|
||||
async function compress(directory: string): Promise<void> {
|
||||
const entries = await readdir(directory, { withFileTypes: true })
|
||||
await Promise.all(
|
||||
entries.map(async (entry) => {
|
||||
const file = path.join(directory, entry.name)
|
||||
if (entry.isDirectory()) return compress(file)
|
||||
if (!/\.(?:js|css|html|svg|json|webmanifest)$/.test(entry.name)) return
|
||||
const original = await readFile(file)
|
||||
if (original.length < 1024) return
|
||||
const compressed = gzipSync(original, { level: 9 })
|
||||
if (compressed.length < original.length)
|
||||
await writeFile(`${file}.gz`, compressed)
|
||||
}),
|
||||
)
|
||||
}
|
||||
return {
|
||||
name: "precompressed-assets",
|
||||
apply: "build",
|
||||
async writeBundle({ dir }) {
|
||||
if (dir) await compress(dir)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
@@ -39,5 +67,6 @@ export default defineConfig({
|
||||
}),
|
||||
react(),
|
||||
tailwindcss(),
|
||||
precompress(),
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user