-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (61 loc) · 1.83 KB
/
vite.config.ts
File metadata and controls
65 lines (61 loc) · 1.83 KB
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
61
62
63
64
65
import { writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import type { Plugin, UserConfig } from "vite";
const isWatch = process.argv.includes("--watch");
const __dirname = dirname(fileURLToPath(import.meta.url));
function notifyAir(): Plugin {
return {
name: "notify-air",
writeBundle() {
writeFileSync(".assets-rebuilt", String(Date.now()));
},
};
}
export default {
resolve: {
alias: [
{
// svgmap doesn't export src/ in package.json "exports"; alias to bypass
find: /^svgmap-variables$/,
replacement: resolve(
__dirname,
"node_modules/svgmap/src/scss/variables",
),
},
{
find: /^svgmap-styles$/,
replacement: resolve(
__dirname,
"node_modules/svgmap/src/scss/svg-map",
),
},
{
// svgmap doesn't export src/js in package.json "exports"; alias to bypass
find: "svgmap/src/js/core/svg-map",
replacement: resolve(
__dirname,
"node_modules/svgmap/src/js/core/svg-map.js",
),
},
],
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
silenceDeprecations: ["import"],
loadPaths: [resolve(__dirname, "node_modules")],
},
},
},
plugins: isWatch ? [notifyAir()] : [],
publicDir: false,
build: {
manifest: "manifest.json",
minify: !isWatch,
rolldownOptions: {
input: "src/main.ts",
},
},
} satisfies UserConfig;