-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.config.ts
More file actions
99 lines (96 loc) · 3.56 KB
/
app.config.ts
File metadata and controls
99 lines (96 loc) · 3.56 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import rehypeShiki from '@shikijs/rehype';
import { transformerNotationHighlight, transformerNotationWordHighlight } from '@shikijs/transformers';
import { transformerTwoslash } from '@shikijs/twoslash';
import { defineConfig } from '@solidjs/start/config';
import mdx from '@vinxi/plugin-mdx';
import { execSync } from 'child_process';
import rehypeSlug from 'rehype-slug';
import remarkGfm from 'remark-gfm';
import svgPlugin from 'vite-plugin-solid-svg';
const defineString = (str?: string) => `"${str || 'unknown'}"`;
export default defineConfig({
ssr: true,
server: {
esbuild: {
options: {
target: 'es2022', // Use modern JavaScript syntax
},
},
preset: process.env.NITRO_PRESET ?? 'netlify', // Use 'netlify' preset for deployment
},
extensions: ['mdx'],
vite: {
build: {
target: 'es2022',
rollupOptions: {
output: {
format: 'esm', // Explicitly set output format to 'esm' to support top-level await
},
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern',
},
},
},
plugins: [
((m: any) => {
const withImports = m?.default?.withImports ?? m?.withImports
const opts = {
jsx: true,
jsxImportSource: 'solid-js',
providerImportSource: 'solid-mdx',
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[
rehypeShiki,
{
themes: {
dark: 'ayu-dark',
light: 'github-light',
},
transformers: [
transformerNotationHighlight(),
transformerNotationWordHighlight(),
transformerTwoslash({
explicitTrigger: true,
}),
],
},
],
],
}
if (withImports) return withImports({})(opts)
// fallback: assume default export is a function that accepts options directly
return m(opts)
})(mdx),
svgPlugin({ defaultAsComponent: true }),
],
define: {
__APP_COMMIT: defineString(
process.env.COMMIT_REF ??
(() => {
try {
return execSync('git rev-parse HEAD').toString().trim()
} catch {
return 'unknown'
}
})()
),
__APP_DEPLOY_CONTEXT: defineString(process.env.CONTEXT ?? process.env.NODE_ENV),
__APP_BRANCH: defineString(
process.env.BRANCH ??
(() => {
try {
return execSync('git rev-parse --abbrev-ref HEAD').toString().trim()
} catch {
return 'unknown'
}
})()
),
},
},
});