-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathsnowpack.config.mjs
73 lines (68 loc) · 1.71 KB
/
snowpack.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Snowpack Configuration File
// See all supported options: https://www.snowpack.dev/reference/configuration
// For some reason, Snowpack takes a long time to process Babylon. When measured
// once, `make build-experiments`, this made the difference between 32 seconds
// and 9 seconds.
const EXCLUDE_BABYLON = process.env["EXCLUDE_BABYLON"];
const babylonExternal = EXCLUDE_BABYLON ? ["@babylonjs/core"] : [];
if (EXCLUDE_BABYLON) {
console.log("Excluding Babylon in Snowpack due to EXCLUDE_BABYLON env var!");
console.log(
"Hopefully this will make Snowpack dep installation significantly faster.",
);
}
const common = {
workspaceRoot: "/",
exclude: ["**/.DS_Store"],
packageOptions: {
knownEntrypoints: ["comlink"],
external: ["crypto", "worker_threads", ...babylonExternal],
},
devOptions: {
port: 3333,
hmr: true,
},
optimize: {
bundle: true,
splitting: true,
minify: true,
target: "es2020",
sourcemap: false,
},
};
export const sitesSnowpackConfig = {
mount: {
"src/sites": { url: "/" },
},
...common,
};
export const twizzleSnowpackConfig = {
mount: {
"src/sites/alpha.twizzle.net": {
url: "/",
dot: true, // for .htaccess
},
},
buildOptions: {
out: "dist/sites/alpha.twizzle.net",
baseUrl: "/",
},
...common,
packageOptions: {
knownEntrypoints: ["comlink"],
external: ["crypto", "worker_threads", "@babylonjs/core"],
},
};
export const experimentsSnowpackConfig = {
mount: {
"src/sites/experiments.cubing.net/cubing.js": {
url: "/",
dot: true, // for .htaccess
},
},
buildOptions: {
out: "dist/sites/experiments.cubing.net/cubing.js",
baseUrl: "/cubing.js",
},
...common,
};