-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathvite.config.mjs
48 lines (45 loc) · 1.13 KB
/
vite.config.mjs
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
import * as child from "child_process";
import fs from "fs";
import path from "path";
import { defineConfig } from "vite";
import mkcert from "vite-plugin-mkcert";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import solidPlugin from "vite-plugin-solid";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";
const commitHash = child
.execSync("git rev-parse --short HEAD")
.toString()
.trim();
const packageJson = JSON.parse(
fs.readFileSync(path.join(__dirname, "package.json"), "utf8"),
);
export default defineConfig({
plugins: [
solidPlugin(),
wasm(),
topLevelAwait(),
mkcert(),
nodePolyfills(),
],
server: {
https: true,
cors: { origin: "*" },
},
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
css: {
preprocessorOptions: {
scss: {
api: "modern-compiler",
},
},
},
define: {
__APP_VERSION__: `"${packageJson.version}"`,
__GIT_COMMIT__: `"${commitHash}"`,
},
});