-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
63 lines (58 loc) · 1.54 KB
/
vite.config.js
File metadata and controls
63 lines (58 loc) · 1.54 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// @ts-check
import { defineConfig } from 'vite';
import { resolve } from 'path';
import typescript from '@rollup/plugin-typescript';
import replace from '@rollup/plugin-replace';
import funcMacro from 'rollup-plugin-func-macro';
import constEnum from 'rollup-plugin-const-enum';
import { replaceOpts, replaceLiteralOpts } from './.scripts/replace.mjs';
const tsconfig = './tsconfig.build.json';
export default defineConfig({
base: './',
plugins: [
typescript({ tsconfig }),
constEnum(),
replace({
preventAssignment: false,
delimiters: ['', ''],
// & replace loggers
values: { ...replaceLiteralOpts },
}),
replace(replaceOpts),
funcMacro(),
],
server: {
open: 'pages/index.html',
},
build: {
outDir: 'dist',
minify: false,
rollupOptions: {
input: {
// pages
index: resolve('pages/index.html'),
import: resolve('pages/import.html'),
about: resolve('pages/about.html'),
donate: resolve('pages/donate.html'),
export: resolve('pages/export.html'),
// js
background: resolve('src/background.ts'),
content: resolve('src/content.ts'),
popup: resolve('src/web/popup.ts'),
},
output: {
entryFileNames: '[name].js',
format: 'es',
},
},
emptyOutDir: true,
},
resolve: {
alias: {
'@/': resolve('src') + '/',
'@web/': resolve('src/web') + '/',
'@assets/': resolve('src/web/assets') + '/',
'@comp/': resolve('src/web/components') + '/',
},
},
});