-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
57 lines (56 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
import { defineConfig, PluginOption } from "vite";
import { babel } from "@rollup/plugin-babel";
import { resolve } from "path";
const root = resolve(__dirname, "src");
import { createHtmlPlugin } from "vite-plugin-html";
import { VitePWA } from "vite-plugin-pwa";
import { Plugin } from "vite";
export default defineConfig(({ command, mode }) => {
return {
esbuild: { drop: ["console", "debugger"] },
root: mode === "test" ? __dirname : root,
plugins: [
VitePWA({
registerType: "autoUpdate",
workbox: { globPatterns: ["*/*"] },
}),
babel({
exclude: [/node_modules/],
babelHelpers: "bundled",
// configFile: resolve(__dirname, "babel.config.cjs"),
extensions: [".ts", ".js"],
}),
// createHtmlPlugin({
// minify: {
// removeAttributeQuotes: false,
// collapseWhitespace: true,
// },
// }),
].flat() as PluginOption[],
build: {
minify: "terser",
terserOptions: {
format: { comments: false },
compress: { drop_console: true, drop_debugger: true },
},
target: "es2015",
rollupOptions: {
plugins: [
createHtmlPlugin({
minify: {
removeComments: true,
removeAttributeQuotes: false,
collapseWhitespace: true,
},
}),
].flat() as Plugin[],
input: [
resolve(root, "index.html"),
resolve(root, "hieroglyphy-encoder.html"),
resolve(root, "jsfuck-encoder.html"),
// resolve(root, "JSfuck-Decoder--and-hieroglyphy--decoder.html"),
],
},
},
};
});