-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
39 lines (35 loc) · 1.06 KB
/
vite.config.ts
File metadata and controls
39 lines (35 loc) · 1.06 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
import { defineConfig } from 'vite'
// import { fileURLToPath, URL } from 'node:url'
import path from 'node:path'
import react from '@vitejs/plugin-react'
import commonjs from 'vite-plugin-commonjs'
import mkCert from 'vite-plugin-mkcert'
type Config = {
mode: string
command: string
isSsrBuild: boolean
isPreview: boolean
}
// https://vite.dev/config/
export default async (config: Config) => {
const env = {
DEV: config.mode === 'development',
PROD: config.mode === 'production',
}
return defineConfig({
define: {
'process.env': env,
// Content-Security-Policy Error Fix for vue-i18n
// https://stackoverflow.com/questions/77288512/vite-vue-3-built-project-content-security-policy-error-csp-script-src-self
__INTLIFY_JIT_COMPILATION__: true,
},
plugins: [react(), commonjs(), mkCert()],
resolve: {
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
alias: {
// '@': fileURLToPath(new URL('./src', import.meta.url)),
'@': path.resolve(__dirname, './src'),
},
},
})
}