From 7e1c7096ce1cdb9e32fcc8e2ca33e35d482fc8a2 Mon Sep 17 00:00:00 2001 From: Ivan Gabaldon Date: Sun, 20 Jul 2025 12:28:11 +0200 Subject: [enh] theme/simple: package.json revision Set minor versioning for most of the packages that iterate fast or we know won't cause problems, and fixed versioning for the rest. Packages going into bundles should be placed in "dependencies". The inspection of prod bundles is necessary. Although it does not make a lot of sense right now, it will be useful in later PR and will give us a reference to start with. --- client/simple/vite.config.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'client/simple/vite.config.ts') diff --git a/client/simple/vite.config.ts b/client/simple/vite.config.ts index 78ca07a2c..a3c766418 100644 --- a/client/simple/vite.config.ts +++ b/client/simple/vite.config.ts @@ -3,11 +3,13 @@ */ import { resolve } from "node:path"; +import { constants as zlibConstants } from "node:zlib"; import browserslistToEsbuild from "browserslist-to-esbuild"; import { browserslistToTargets } from "lightningcss"; import type { Config } from "svgo"; import type { UserConfig } from "vite"; -import { browserslist } from "./package.json"; +import analyzer from "vite-bundle-analyzer"; +import manifest from "./package.json"; import { plg_svg2png, plg_svg2svg } from "./tools/plg"; const ROOT = "../../"; // root of the git repository @@ -35,8 +37,8 @@ export default { // mode: "development", build: { - target: browserslistToEsbuild(browserslist), - cssTarget: browserslistToEsbuild(browserslist), + target: browserslistToEsbuild(manifest.browserslist), + cssTarget: browserslistToEsbuild(manifest.browserslist), manifest: "manifest.json", emptyOutDir: true, assetsDir: "", @@ -85,6 +87,24 @@ export default { }, // end: build plugins: [ + // -- bundle analyzer + analyzer({ + enabled: process.env.VITE_BUNDLE_ANALYZE === "true", + analyzerPort: "auto", + summary: true, + reportTitle: manifest.name, + + // sidecars with max compression + gzipOptions: { + level: zlibConstants.Z_BEST_COMPRESSION + }, + brotliOptions: { + params: { + [zlibConstants.BROTLI_PARAM_QUALITY]: zlibConstants.BROTLI_MAX_QUALITY + } + } + }), + // -- svg images plg_svg2svg( [ @@ -134,7 +154,7 @@ export default { css: { transformer: "lightningcss", lightningcss: { - targets: browserslistToTargets(browserslist) + targets: browserslistToTargets(manifest.browserslist) }, devSourcemap: true }, // end: css -- cgit v1.2.3