forked from 0xKrauser/miya.wtf
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.ts
83 lines (82 loc) · 2 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import react from '@vitejs/plugin-react'
import path from 'path'
import { defineConfig } from 'vite'
import macrosPlugin from 'vite-plugin-babel-macros'
import dynamicImport from 'vite-plugin-dynamic-import'
import imagePresets, { widthPreset } from 'vite-plugin-image-presets'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import svgr from 'vite-plugin-svgr'
export default defineConfig({
base: '',
plugins: [
react(),
dynamicImport(),
svgr(),
macrosPlugin(),
imagePresets({
pattern: widthPreset({
loading: 'eager',
widths: [2],
formats: {
webp: { quality: 100 },
},
}),
icon: widthPreset({
loading: 'eager',
widths: [16, 60],
formats: {
webp: { quality: 50 },
},
}),
thumbnail: widthPreset({
loading: 'lazy',
widths: [120, 170],
formats: {
webp: { quality: 50 },
},
}),
banner: widthPreset({
class: 'banner',
loading: 'eager',
widths: [500],
formats: {
webp: { quality: 50 },
},
}),
avatar: widthPreset({
loading: 'lazy',
widths: [325],
formats: {
webp: { quality: 50 },
},
}),
}),
nodePolyfills({
// Whether to polyfill specific globals.
globals: {
Buffer: true, // can also be 'build', 'dev', or false
global: true,
process: true,
},
// Whether to polyfill `node:` protocol imports.
protocolImports: true,
}),
],
build: {
sourcemap: true,
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
{ find: 'abis', replacement: path.resolve(__dirname, 'abis') },
{
find: 'typechain',
replacement: path.resolve(__dirname, './typechain'),
},
{ find: 'assets', replacement: path.resolve(__dirname, 'src/assets') },
],
},
optimizeDeps: {
disabled: 'build',
},
})