-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvite.config.js
43 lines (39 loc) · 1002 Bytes
/
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
import { resolve } from "path";
import react from "@vitejs/plugin-react";
import postcssPresetEnv from "postcss-preset-env";
import { defineConfig } from "vite";
const PROJECT = process.env.PROJECT || "demo";
const resolveFile = (file) =>
["chrome", "firefox"].includes(PROJECT)
? `#stores/${file}/extension`
: `#stores/${file}/web`;
export default defineConfig({
build: {
assetsInlineLimit: 0,
outDir: `dist-${PROJECT}`,
rollupOptions: {
input: [
resolve(__dirname, "index.html"),
resolve(__dirname, "settings.html"),
],
},
target: "esnext",
},
css: {
postcss: {
plugins: [postcssPresetEnv()],
},
},
define: {
__CHROME__: PROJECT === "chrome",
__FIREFOX__: PROJECT === "firefox",
},
plugins: [react()],
publicDir: `public/${PROJECT}`,
resolve: {
alias: {
"#stores/useSettings/web": resolveFile("useSettings"),
"#stores/useBookmarks/web": resolveFile("useBookmarks"),
},
},
});