-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
37 lines (34 loc) · 1.14 KB
/
vite.config.js
File metadata and controls
37 lines (34 loc) · 1.14 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
import { readFileSync } from "fs";
import { sveltekit } from "@sveltejs/kit/vite";
import { timeFormat } from "d3";
import path from "path";
import svg from "vite-plugin-svgstring";
import dsv from "@rollup/plugin-dsv";
const { version } = JSON.parse(readFileSync("package.json", "utf8"));
const timestamp = timeFormat("%Y-%m-%d-%H:%M")(new Date());
const config = {
define: {
__VERSION__: JSON.stringify(version),
__TIMESTAMP__: JSON.stringify(timestamp)
},
plugins: [sveltekit(), dsv(), svg()],
// Ensure certain deps are bundled for SSR so Node doesn't try to
// resolve extensionless ESM imports (e.g., wx-grid-locales ./locales/en)
// which would otherwise fail under native Node ESM resolution.
ssr: {
noExternal: ["wx-svelte-grid", "wx-grid-locales"]
},
resolve: {
alias: {
$actions: path.resolve("./src/actions"),
$components: path.resolve("./src/components"),
$data: path.resolve("./src/data"),
$routes: path.resolve("./src/routes"),
$stores: path.resolve("./src/stores"),
$styles: path.resolve("./src/styles"),
$svg: path.resolve("./src/svg"),
$utils: path.resolve("./src/utils")
}
}
};
export default config;