Nuxt/packages/ui-templates/vite.config.ts

37 lines
776 B
TypeScript
Raw Normal View History

2021-12-22 13:04:06 +00:00
import { resolve } from 'path'
import { readdirSync } from 'fs'
import { defineConfig } from 'vite'
import UnoCSS from 'unocss/vite'
2021-12-22 13:04:06 +00:00
import { DevRenderingPlugin } from './lib/dev'
import { RenderPlugin } from './lib/render'
const r = (...path: string[]) => resolve(__dirname, ...path)
export default defineConfig({
build: {
rollupOptions: {
input: {
...Object.fromEntries(
readdirSync(r('templates')).filter(dir => dir !== 'messages.json').map(dir => [
dir,
r('templates', dir, 'index.html')
])
),
index: r('index.html')
}
}
},
plugins: [
UnoCSS(),
2021-12-22 13:04:06 +00:00
DevRenderingPlugin(),
RenderPlugin()
],
server: {
fs: {
allow: ['./templates', __dirname]
}
}
})