-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
64 lines (62 loc) · 1.95 KB
/
Copy pathvite.config.js
File metadata and controls
64 lines (62 loc) · 1.95 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath, URL } from "node:url";
import { readFileSync } from "node:fs";
const packageJson = JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf-8")
);
const appVersion = packageJson.version ?? "0.0.0";
const appReleaseTag = `v${appVersion}`;
// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
const isDev = command === "serve";
const diagnosticsChannelShim = fileURLToPath(
new URL("./src/shims/diagnostics_channel.ts", import.meta.url),
);
return {
plugins: [vue()],
define: {
__APP_VERSION__: JSON.stringify(appVersion),
__APP_RELEASE_TAG__: JSON.stringify(appReleaseTag),
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
// Comunica v5 pulls in lru-cache, which references Node diagnostics channels.
// Route both module specifiers to a browser-safe shim.
"node:diagnostics_channel": diagnosticsChannelShim,
diagnostics_channel: diagnosticsChannelShim,
},
},
base: isDev ? "./" : "/solid-cockpit/",
build: {
outDir: "dist",
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes("@triply/yasqe") || id.includes("@triply/yasr")) {
return "query-editors";
}
if (
id.includes("@comunica/") ||
id.includes("query-sparql-remote-cache") ||
id.includes("actor-query-process-remote-cache")
) {
return "query-engine";
}
if (id.includes("@inrupt/solid-client")) {
return "solid-client";
}
return undefined;
},
},
},
},
server: {
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
};
});