generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
45 lines (44 loc) · 1.19 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
import preact from "@preact/preset-vite";
import { resolve } from "path";
import { defineConfig } from "vite";
import { viteStaticCopy } from "vite-plugin-static-copy";
export default defineConfig(({ mode }) => ({
plugins: [
preact(),
viteStaticCopy({
targets: [
{ src: "styles.css", dest: "./" },
{ src: "manifest.json", dest: "./" },
],
}),
],
build: {
emptyOutDir: false, // Otherwise helpful files like ".hotreload" will be wiped.
lib: {
entry: "src/main.tsx",
fileName: () => "main.js",
formats: ["cjs"],
},
rollupOptions: {
treeshake: true,
external: ["obsidian"],
},
sourcemap: mode === "development" ? "inline" : false,
},
resolve: {
alias: {
"@": resolve(__dirname, "/src"),
react: "preact/compat",
"react-dom": "preact/compat",
},
},
test: {
environment: "jsdom",
coverage: {
all: true,
include: ["src/"],
exclude: ["src/main.tsx"],
},
passWithNoTests: true,
},
}));