-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
48 lines (45 loc) · 1.26 KB
/
vite.config.js
File metadata and controls
48 lines (45 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { readFileSync } from 'fs';
const packageJson = JSON.parse(readFileSync('./package.json', 'utf-8'));
// Get the repository name for GitHub Pages base path
// For example, if your repo is username/otzarot-game, the base should be '/otzarot-game/'
// If deploying to a custom domain or user page (username.github.io), use '/'
const base = process.env.NODE_ENV === 'production' ? '/otzarot-game/' : '/';
// https://vitejs.dev/config/
export default defineConfig({
base: base,
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(packageJson.version),
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@components': path.resolve(__dirname, './src/components'),
'@context': path.resolve(__dirname, './src/context'),
},
},
server: {
port: 3000,
open: true,
host: true,
},
build: {
outDir: 'dist',
minify: 'terser',
sourcemap: false,
rollupOptions: {
output: {
manualChunks: {
'vendor': ['react', 'react-dom', 'framer-motion'],
},
},
},
},
optimizeDeps: {
include: ['react', 'react-dom', 'framer-motion'],
},
});