-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.ts
132 lines (129 loc) · 2.83 KB
/
astro.config.ts
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
import type { defineConfig } from "astro/config";
import type { ViteDevServer } from "vite";
export const Tauri = typeof process.env["TAURI_ENV_ARCH"] !== "undefined";
export const On =
process.env["NODE_ENV"] === "development" ||
process.env["TAURI_ENV_DEBUG"] === "true";
export default (await import("astro/config")).defineConfig({
srcDir: "./Source",
publicDir: "./Public",
outDir: "./Target",
site: On
? "http://localhost"
: Tauri
? "https://tauri.localhost"
: "https://editor.land",
compressHTML: !On,
prefetch: {
defaultStrategy: "hover",
prefetchAll: true,
},
server: {
port: 9999,
},
build: {
concurrency: 9999,
},
integrations: [
(await import("@astrojs/solid-js")).default({
// @ts-ignore
devtools: On,
}),
Tauri ? null : (await import("@astrojs/sitemap")).default(),
!On ? (await import("@playform/inline")).default({ Logger: 1 }) : null,
!On
? (await import("@playform/compress")).default({ Logger: 1 })
: null,
],
experimental: {
clientPrerender: true,
contentIntellisense: true,
},
vite: {
build: {
sourcemap: On,
manifest: true,
minify: On ? false : "terser",
cssMinify: On ? false : "esbuild",
terserOptions: On
? {
compress: false,
ecma: 2020,
enclose: false,
format: {
ascii_only: false,
braces: false,
comments: false,
ie8: false,
indent_level: 4,
indent_start: 0,
inline_script: false,
keep_numbers: true,
keep_quoted_props: true,
max_line_len: 80,
preamble: null,
ecma: 5,
preserve_annotations: true,
quote_keys: false,
quote_style: 3,
safari10: true,
semicolons: true,
shebang: false,
shorthand: false,
webkit: true,
wrap_func_args: true,
wrap_iife: true,
},
sourceMap: true,
ie8: true,
keep_classnames: true,
keep_fnames: true,
mangle: false,
module: true,
toplevel: true,
}
: {},
},
optimizeDeps: {
...(On
? {
exclude: [
"@codeeditorland/common",
"@codeeditorland/wind",
"@codeeditorland/output",
],
}
: {}),
},
resolve: {
preserveSymlinks: true,
},
css: {
devSourcemap: On,
transformer: "postcss",
},
plugins: [
// @ts-expect-error
(await import("vite-plugin-top-level-await")).default(),
// @ts-expect-error
((Module: string[]) => ({
name: "NodeModules",
configureServer: (server: ViteDevServer): void => {
server.watcher.options = {
...server.watcher.options,
ignored: [
new RegExp(
`/node_modules\\/(?!${Module.join("|")}).*/`,
),
"**/.git/**",
],
};
},
}))([
"@codeeditorland/common",
"@codeeditorland/wind",
"@codeeditorland/output",
]),
],
},
}) as typeof defineConfig;