-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
90 lines (86 loc) · 2.48 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
import path, { resolve } from "path";
import { defineConfig } from "vite";
import vitePugPlugin from "vite-plugin-pug-transformer";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import viteImagemin from "vite-plugin-imagemin";
const ASSET_PATH = process.env.ASSET_PATH || "/";
export default defineConfig({
base: "/EW-frontend/",
build: {
outDir: "build",
assetsDir: "assets",
minify: false,
rollupOptions: {
input: {
main: resolve(__dirname, "index.html"),
landing: resolve(__dirname, "landing.html"),
designSupport: resolve(__dirname, "design-support.html"),
team: resolve(__dirname, "team.html"),
cases: resolve(__dirname, "cases.html"),
contacts: resolve(__dirname, "contacts.html"),
error404: resolve(__dirname, "404.html"),
seo: resolve(__dirname, "seo.html"),
thankyou: resolve(__dirname, "thank-you.html"),
corporatewebsites: resolve(__dirname, "corporate-websites.html"),
sitevizitka: resolve(__dirname, "site-vizitka.html"),
case: resolve(__dirname, "case.html"),
},
output: {
chunkFileNames: "assets/js/app-[hash].js",
entryFileNames: "assets/js/[name]-[hash].js",
assetFileNames: ({ name }) => {
if (/\.(gif|jpe?g|png|svg|mp4)$/.test(name ?? "")) {
return "assets/media/[name]-[hash][extname]";
}
if (/\.css$/.test(name ?? "")) {
return "assets/css/[name]-[hash][extname]";
}
if (/\.woff|2$/.test(name ?? "")) {
return "assets/fonts/[name]-[extname]";
}
return "assets/[name]-[hash][extname]";
},
},
},
},
server: {
open: true,
},
css: {
devSourcemap: true,
},
plugins: [
vitePugPlugin(),
createSvgIconsPlugin({
symbolId: "[name]",
iconDirs: [path.resolve(process.cwd(), "src/assets/images/icons")],
}),
// viteImagemin({
// gifsicle: {
// optimizationLevel: 7,
// interlaced: false,
// },
// optipng: {
// optimizationLevel: 7,
// },
// mozjpeg: {
// quality: 100,
// },
// pngquant: {
// quality: [0.8, 0.9],
// speed: 4,
// },
// svgo: {
// plugins: [
// {
// name: "removeViewBox",
// },
// {
// name: "removeEmptyAttrs",
// active: false,
// },
// ],
// },
// }),
],
});