Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
78 lines (74 loc) · 2.32 KB
/
Copy pathvite.config.ts
File metadata and controls
78 lines (74 loc) · 2.32 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import tailwindcss from "@tailwindcss/vite"
import { tanstackStart } from "@tanstack/solid-start/plugin/vite"
import { visualizer } from "rollup-plugin-visualizer"
import type { Plugin } from "vite"
import { defineConfig } from "vite"
import solid from "vite-plugin-solid"
import { getPrerenderPages } from "./src/lib/prerenderPages"
import { siteUrl } from "./src/lib/seo"
const prerenderPages = getPrerenderPages()
function tailwindStandaloneCssStubPlugin(): Plugin {
const standaloneCssPattern =
/(?:^|[/\\])node_modules[/\\]tailwindcss[/\\](?:index|theme|preflight|utilities)\.css(?:\?.*)?$/
return {
name: "tailwind-standalone-css-stub",
apply: "serve",
enforce: "pre",
load(id) {
if (!standaloneCssPattern.test(id)) return
return ""
},
}
}
export default defineConfig({
server: {
port: 3031,
strictPort: true,
watch: {
ignored: ["**/.github/**", "**/data/**", "**/dist/**", "**/ops/**", "**/out/**", "**/docs/**", "**/test/**"],
},
allowedHosts: ["solid-ui.david-siewert.com"],
},
plugins: [
tanstackStart({
srcDirectory: "src",
router: {
quoteStyle: "double",
semicolons: false,
routesDirectory: "routes",
},
// Phase 2: prerender every demo path to static HTML (SSG) and emit a
// sitemap. Each concrete path is supplied via `pages` (derived from the
// demo source tree) since the routes are served by a single splat route.
prerender: {
enabled: true,
crawlLinks: false,
autoStaticPathsDiscovery: false,
autoSubfolderIndex: false,
},
pages: prerenderPages,
sitemap: {
host: siteUrl,
},
}),
// @ts-ignore - solid plugin types
solid({ ssr: true }),
tailwindStandaloneCssStubPlugin(),
tailwindcss(),
visualizer({ filename: "dist/bundle-size.html", gzipSize: true }),
],
envPrefix: "PUBLIC_",
// `@adaptive-ds/utils` ships ESM with extension-less relative imports, which
// Node's ESM loader rejects when the package is externalized in the prerender
// server bundle. Bundling it through Vite (which resolves those imports) fixes
// the prerender crash.
ssr: {
noExternal: ["@adaptive-ds/utils"],
},
build: {
chunkSizeWarningLimit: 1050,
outDir: "out",
assetsDir: "assets",
emptyOutDir: true,
},
})