-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
executable file
·45 lines (41 loc) · 1.38 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
import { crx } from "@crxjs/vite-plugin";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { defineConfig } from "vite";
import manifest from "./src/manifest.config";
import UnoCSS from '@unocss/svelte-scoped/vite'
import obfuscatorPlugin from "vite-plugin-javascript-obfuscator";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const isProduction = mode === 'production';
return {
plugins: [UnoCSS(), svelte({ emitCss: false }), crx({ manifest }), obfuscatorPlugin({
include: ["src/**/*.ts", "src/**/*.js"],
apply: "build",
debugger: true,
options: {
optionsPreset: "high-obfuscation",
}
})],
build: {
outDir: isProduction ? "build" : "dev-build",
emptyOutDir: true,
minify: isProduction ? "terser" : false,
terserOptions: {
compress: {
drop_console: true,
},
mangle: true,
},
},
publicDir: "./src/public",
// HACK: https://github.com/crxjs/chrome-extension-tools/issues/696
// https://github.com/crxjs/chrome-extension-tools/issues/746
server: {
port: 5174,
strictPort: true,
hmr: {
clientPort: 5174,
},
},
}
});