-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
60 lines (58 loc) · 1.54 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
import path, { resolve } from "node:path";
import url from "node:url";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import { Mode, plugin as markdownPlugin } from "vite-plugin-markdown";
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// https://ja.vitejs.dev/config/
export default defineConfig({
root: "./src",
base: "/",
publicDir: "./raw",
plugins: [react(), markdownPlugin({ mode: [Mode.HTML, Mode.TOC] })],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
build: {
target: "esnext",
emptyOutDir: true,
modulePreload: false,
minify: "terser",
terserOptions: {
module: true,
compress: {
module: true,
unused: true,
passes: 3,
},
mangle: {
toplevel: true,
module: true,
},
format: {
comments: false,
},
toplevel: true,
},
rollupOptions: {
input: {
index: resolve(__dirname, "src", "content_scripts", "index.ts"),
background: resolve(__dirname, "src", "background.ts"),
popup: resolve(__dirname, "src", "popup", "popup.html"),
options: resolve(__dirname, "src", "options", "options.html"),
how_to_use: resolve(__dirname, "src", "how_to_use", "how_to_use.html"),
},
output: {
entryFileNames: "js/[name].js",
chunkFileNames: "js/[hash].js",
assetFileNames: "assets/[ext]/[name].[ext]",
},
},
},
worker: {
format: "es",
},
});