-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
57 lines (53 loc) · 1.24 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
46
47
48
49
50
51
52
53
54
55
56
57
import child_process from "node:child_process";
import path from "node:path";
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import copy from "rollup-plugin-simple-copy/vite";
function sw() {
let proc;
return {
name: "build-sw",
apply: "serve",
buildStart() {
if (!proc) {
proc = child_process.spawn("npm", ["run", "build:sw", "--", "--watch"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true
});
}
},
buildEnd() {
if (proc) {
proc.kill()
proc = null;
}
}
};
}
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: [
{ find: "$src/", replacement: path.join(__dirname, "src/") },
],
},
plugins: [
svelte(),
copy({
extMap: {
".svg": "image/svg+xml",
},
targets: [
{
src: "node_modules/@shoelace-style/shoelace/dist/assets",
dest: "shoelace/assets",
filter(src) {
const re = /.+\/(sun|moon|list|check2-circle|plus-square|x|trash|folder|arrow-clockwise|pencil|layout-split|code-square)\.svg$/;
return re.test(src);
},
}
],
}),
sw(),
],
})