-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.ts
58 lines (56 loc) · 1.63 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
import { defineConfig } from "astro/config"
import nodeWs from "astro-node-websocket"
import preact from "@preact/preset-vite"
import emotion from "astro-emotion"
import precompress from "./lib/precompress.ts"
import fontLoader from "./lib/font-loader.ts"
const vite: import("vite").UserConfig = {
plugins: [
// using preact vite plugin directly to configure babel
preact({
reactAliasesEnabled: false,
babel: {
plugins: [[ "@babel/plugin-proposal-decorators", { version: "2023-11" } ]]
}
}),
],
ssr: {
// inline all npm dependencies
noExternal: import.meta.env.PROD || undefined
},
build: {
// keep css and js assets external
assetsInlineLimit: 0,
// view uncompiled sourcemaps in devtools
sourcemap: true,
// prevent overly long asset names
rollupOptions: {
output: {
entryFileNames: '_astro/[hash].mjs',
assetFileNames: '_astro/[hash][extname]'
}
}
},
// bundle service worker into a module
worker: {
format: "es"
}
}
// https://astro.build/config
export default defineConfig({
srcDir: ".",
integrations: [
emotion({ stylisPlugins: [] }),
fontLoader(),
precompress,
],
adapter: nodeWs({ mode: "standalone" }),
output: "server",
// bind to all interfaces in dev allowing other devices on wifi to connect
server: {
host: import.meta.env.DEV ? "0.0.0.0" : "127.0.0.1",
},
// more intrusive than helpful
devToolbar: { enabled: false },
vite
})