summaryrefslogtreecommitdiff
path: root/client/simple/vite.config.ts
diff options
context:
space:
mode:
authorIvan Gabaldon <igabaldon@inetol.net>2025-07-20 12:28:11 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-08-18 16:38:32 +0200
commit7e1c7096ce1cdb9e32fcc8e2ca33e35d482fc8a2 (patch)
treeea25d4042516f771dc42e0260c7971f153d02994 /client/simple/vite.config.ts
parent0b913053a76e83a43846e19097963f98c8519a1d (diff)
[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.
Diffstat (limited to 'client/simple/vite.config.ts')
-rw-r--r--client/simple/vite.config.ts28
1 files changed, 24 insertions, 4 deletions
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