From ea56f4a93c9a8b6188bc73b80801ac08a4152c17 Mon Sep 17 00:00:00 2001 From: Danilo Znamerovszkij <31888918+danilo-znamerovszkij@users.noreply.github.com> Date: Fri, 26 Sep 2025 17:44:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20prepare=20for=20vercel=20deploy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .nvmrc | 2 +- package.json | 6 +++++- tsconfig.json | 8 ++++---- vercel.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ vite.config.ts | 14 ++++++++++++-- 5 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 vercel.json diff --git a/.nvmrc b/.nvmrc index 1d9b783..e222811 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.12.0 +22.19.0 diff --git a/package.json b/package.json index be28710..3b65d98 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,15 @@ "private": true, "version": "0.0.0", "type": "module", + "engines": { + "node": ">=20.19.0" + }, "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "type-check": "tsc --noEmit" + "type-check": "tsc --noEmit", + "vercel-build": "npm run build" }, "devDependencies": { "sass": "^1.91.0", diff --git a/tsconfig.json b/tsconfig.json index 37912c2..010163b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { - "target": "ES2022", + "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2022", "DOM", "DOM.Iterable"], + "lib": ["ES2020", "DOM", "DOM.Iterable"], "skipLibCheck": true, /* Bundler mode */ @@ -15,8 +15,8 @@ /* Linting */ "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "noUnusedLocals": false, + "noUnusedParameters": false, "erasableSyntaxOnly": true, "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true, diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..c7299c2 --- /dev/null +++ b/vercel.json @@ -0,0 +1,44 @@ +{ + "buildCommand": "npm run build", + "outputDirectory": "dist", + "framework": "vite", + "functions": { + "app/api/**/*.js": { + "runtime": "nodejs20.x" + } + }, + "rewrites": [ + { + "source": "/(.*)", + "destination": "/index.html" + } + ], + "headers": [ + { + "source": "/assets/(.*)", + "headers": [ + { + "key": "Cache-Control", + "value": "public, max-age=31536000, immutable" + } + ] + }, + { + "source": "/(.*)", + "headers": [ + { + "key": "X-Content-Type-Options", + "value": "nosniff" + }, + { + "key": "X-Frame-Options", + "value": "DENY" + }, + { + "key": "X-XSS-Protection", + "value": "1; mode=block" + } + ] + } + ] +} diff --git a/vite.config.ts b/vite.config.ts index 942b916..7a7c9c9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,14 +11,24 @@ export default defineConfig({ historyApiFallback: true }, build: { - target: 'esnext', + target: 'es2020', minify: 'esbuild', + sourcemap: false, rollupOptions: { output: { manualChunks: { echarts: ['echarts'] } } - } + }, + chunkSizeWarningLimit: 1000, + outDir: 'dist', + emptyOutDir: true + }, + optimizeDeps: { + include: ['echarts'] + }, + define: { + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production') } })