-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
103 lines (101 loc) · 2.32 KB
/
vite.config.js
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/** @type {import('vite').UserConfig} */
import { defineConfig } from "vite";
import sass from "sass";
import stylelint from "vite-plugin-stylelint";
import { ViteImageOptimizer } from "vite-plugin-image-optimizer";
import svgr from "vite-plugin-svgr";
// import * as path from "path";
// import { fileURLToPath } from "node:url";
const DEFAULT_OPTIONS = {
test: /\.(jpe?g|png|gif|tiff|webp|svg|avif)$/i,
exclude: undefined,
include: undefined,
includePublic: true,
logStats: true,
ansiColors: true,
svg: {
multipass: true,
plugins: [
{
name: "preset-default",
params: {
overrides: {
cleanupNumericValues: false,
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
},
cleanupIDs: {
minify: false,
remove: false,
},
convertPathData: false,
},
},
"sortAttrs",
{
name: "addAttributesToSVGElement",
params: {
attributes: [{ xmlns: "http://www.w3.org/2000/svg" }],
},
},
],
},
png: {
// https://sharp.pixelplumbing.com/api-output#png
quality: 100,
},
jpeg: {
// https://sharp.pixelplumbing.com/api-output#jpeg
quality: 100,
},
jpg: {
// https://sharp.pixelplumbing.com/api-output#jpeg
quality: 100,
},
tiff: {
// https://sharp.pixelplumbing.com/api-output#tiff
quality: 100,
},
// gif does not support lossless compression
// https://sharp.pixelplumbing.com/api-output#gif
gif: {},
webp: {
// https://sharp.pixelplumbing.com/api-output#webp
lossless: true,
},
avif: {
// https://sharp.pixelplumbing.com/api-output#avif
lossless: true,
},
};
/* OPTIONS */
export default defineConfig({
plugins: [
stylelint({
// recommend to enable auto fix
fix: true,
build: true,
dev: true,
}),
svgr(),
ViteImageOptimizer({
/* pass your config */
DEFAULT_OPTIONS,
}),
],
// base: "./",
clearScreen: false,
logLevel: "info", // info, warn, error, silent
envDir: "./", // direct to specified env folder.
envPrefix: "RAY_THOMP",
css: {
devsourceMap: true, // source map for scss file
preprocessorOptions: {
scss: {
implementation: sass,
},
},
},
server: {
port: 3000,
},
});