-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
45 lines (44 loc) · 1.38 KB
/
vite.config.ts
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
import { resolve } from 'node:path'
import { type UserConfigFnObject, defineConfig, loadEnv } from 'vite'
import { createHtmlPlugin } from 'vite-plugin-html'
import type { ImportMetaEnv } from './src/vite-env'
// noinspection JSUnusedGlobalSymbols
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '') as unknown as ImportMetaEnv
return {
root: './src',
publicDir: '../public',
resolve: {
alias: {
$BOOTSTRAP_PATH: env?.ENABLE_BOOTSTRAP_REBOOT === 'true'
? 'bootstrap/scss/bootstrap'
: 'bootstrap-no-reboot',
},
},
plugins: [
createHtmlPlugin({ minify: true }),
],
build: {
outDir: '../dist',
target: 'esnext',
minify: 'esbuild',
rollupOptions: {
input: {
main: resolve(__dirname, './src/index.html'),
checkout: resolve(__dirname, './src/checkout.html'),
about: resolve(__dirname, './src/about.html'),
convertColors: resolve(__dirname, './src/convertColours.html'),
creditcard: resolve(__dirname, './src/creditcard.html'),
instructions: resolve(__dirname, './src/instructions.html'),
},
},
},
esbuild: {
legalComments: 'none',
minifySyntax: true,
minifyWhitespace: true,
minifyIdentifiers: true,
platform: 'browser',
},
}
}) satisfies UserConfigFnObject