-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.ts
43 lines (42 loc) · 1.11 KB
/
vite.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
import path from 'path'
import honox from 'honox/vite'
import { defineConfig } from 'vite'
import nodeServerPlugin from './vite-node-server-plugin'
const root = './'
export default defineConfig(({ mode }) => {
if (mode === 'client') {
return {
build: {
manifest: true,
rollupOptions: {
input: {
styles: '/app/styles.css',
client: '/app/client.ts',
},
output: {
entryFileNames: 'static/[name].[hash].js',
chunkFileNames: 'static/chunks/[name].[hash].js',
assetFileNames: 'static/assets/[name].[ext]',
},
},
},
}
} else {
return {
plugins: [
honox({
islandComponents: {
isIsland: (id) => {
const resolvedPath = path.resolve(root).replace(/\\/g, '\\\\')
const regexp = new RegExp(
`${resolvedPath}[\\\\/]app[^\\\\/]*[\\\\/]islands[\\\\/].+\.tsx?$`,
)
return regexp.test(path.resolve(id))
},
},
}),
nodeServerPlugin(),
],
}
}
})