generated from the-pudding/svelte-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.js
41 lines (38 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
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";
import { esbuildCommonjs, viteCommonjs } from "@originjs/vite-plugin-commonjs";
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(), viteCommonjs()],
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"),
$shaders: path.resolve("./src/shaders")
}
},
ssr: {
noExternal: ["three", "threestrap", "mathbox", "shadergraph", "postprocessing"]
},
optimizeDeps: {
esbuildOptions: {
plugins: [esbuildCommonjs(["mathbox"])]
}
}
};
export default config;