-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.preview.config.ts
65 lines (62 loc) · 1.59 KB
/
vite.preview.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import replace from '@rollup/plugin-replace'
import UnoCSS from 'unocss/vite'
import { presetUno, presetIcons, presetWebFonts, transformerDirectives } from 'unocss'
import { lightGreen, yellow, gray, bold } from 'kolorist'
import banner from 'vite-plugin-banner'
import { templateCompilerOptions } from '@tresjs/core'
import pkg from './package.json'
console.log(`${lightGreen('▲')} ${gray('■')} ${yellow('⛫')} ${bold('Tres/repl')} v${pkg.version}`)
export default defineConfig({
plugins: [
vue(templateCompilerOptions),
banner({
content: `/**\n * name: ${pkg.name}\n * version: v${
pkg.version
}\n * (c) ${new Date().getFullYear()}\n * description: ${pkg.description}\n * author: ${pkg.author}\n */`,
}),
UnoCSS({
/* options */
presets: [
presetUno(),
presetIcons({
scale: 1.2,
warn: true,
extraProperties: {
display: 'inline-block',
'vertical-align': 'middle',
// ...
},
}),
presetWebFonts({
fonts: {
sans: 'Inter',
},
}),
],
transformers: [transformerDirectives()],
}),
],
resolve: {
alias: {
path: 'path-browserify',
},
},
build: {
commonjsOptions: {
ignore: ['typescript'],
},
},
worker: {
format: 'es',
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
],
},
})