update vite, add analyzer

This commit is contained in:
Samuel Newman
2026-05-13 13:39:46 +03:00
parent 7cb3499c2a
commit de99bc2cc5
4 changed files with 417 additions and 656 deletions
+5 -4
View File
@@ -7,6 +7,7 @@
"dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n", "dev-snippet": "tsc --project tsconfig.snippet.json && serve -s dist -p 3000 -n",
"build": "tsc && vite build", "build": "tsc && vite build",
"build-snippet": "tsc --project tsconfig.snippet.json", "build-snippet": "tsc --project tsconfig.snippet.json",
"analyze": "ANALYZE=1 vite build",
"lint": "eslint --cache src", "lint": "eslint --cache src",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"format": "prettier -w src" "format": "prettier -w src"
@@ -18,7 +19,7 @@
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.18.0", "@eslint/js": "^9.18.0",
"@preact/preset-vite": "^2.10.2", "@preact/preset-vite": "^2.10.2",
"@vitejs/plugin-legacy": "^7.0.0", "@vitejs/plugin-legacy": "^8.0.1",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"eslint": "^9.18.0", "eslint": "^9.18.0",
"eslint-plugin-import-x": "^4.16.2", "eslint-plugin-import-x": "^4.16.2",
@@ -29,10 +30,10 @@
"serve": "^14.2.5", "serve": "^14.2.5",
"tailwindcss": "^3.4.3", "tailwindcss": "^3.4.3",
"terser": "^5.43.1", "terser": "^5.43.1",
"typescript": "^5.8.3", "typescript": "^6.0.3",
"typescript-eslint": "^8.20.0", "typescript-eslint": "^8.20.0",
"vite": "^7.0.4", "vite": "^8.0.12",
"vite-tsconfig-paths": "^5.1.4" "vite-bundle-analyzer": "^1.3.8"
}, },
"resolutions": { "resolutions": {
"@types/estree": "1.0.6" "@types/estree": "1.0.6"
+402 -647
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES5", "target": "ES2015",
"lib": ["DOM", "DOM.Iterable", "ESNext"], "lib": ["DOM", "ESNext"],
"strict": true, "strict": true,
"outDir": "dist" "outDir": "dist"
}, },
+8 -3
View File
@@ -1,10 +1,10 @@
import fs from 'node:fs' import fs from 'node:fs'
import {resolve} from 'node:path' import {resolve} from 'node:path'
import preact from '@preact/preset-vite' import {preact} from '@preact/preset-vite'
import legacy from '@vitejs/plugin-legacy' import legacy from '@vitejs/plugin-legacy'
import type {Plugin, UserConfig} from 'vite' import type {Plugin, UserConfig} from 'vite'
import paths from 'vite-tsconfig-paths' import {analyzer} from 'vite-bundle-analyzer'
/** /**
* World's hackiest router, for dev only. Serves `/post.html` to requests that start with `/embed/` * World's hackiest router, for dev only. Serves `/post.html` to requests that start with `/embed/`
@@ -38,11 +38,13 @@ function devOnlyRouter(): Plugin {
const config: UserConfig = { const config: UserConfig = {
plugins: [ plugins: [
preact(), preact(),
paths(),
legacy({ legacy({
targets: ['defaults', 'not IE 11'], targets: ['defaults', 'not IE 11'],
}), }),
devOnlyRouter(), devOnlyRouter(),
analyzer({
enabled: process.env.ANALYZE === '1',
}),
], ],
build: { build: {
assetsDir: 'static', assetsDir: 'static',
@@ -53,6 +55,9 @@ const config: UserConfig = {
}, },
}, },
}, },
resolve: {
tsconfigPaths: true,
},
} }
export default config export default config