mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
42 lines
880 B
TypeScript
42 lines
880 B
TypeScript
|
import { resolve } from 'path'
|
||
|
import { readdirSync } from 'fs'
|
||
|
|
||
|
import { defineConfig } from 'vite'
|
||
|
import WindiCSS from 'vite-plugin-windicss'
|
||
|
|
||
|
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: [
|
||
|
WindiCSS({
|
||
|
scan: {
|
||
|
dirs: ['templates'],
|
||
|
fileExtensions: ['html']
|
||
|
}
|
||
|
}),
|
||
|
DevRenderingPlugin(),
|
||
|
RenderPlugin()
|
||
|
],
|
||
|
server: {
|
||
|
fs: {
|
||
|
allow: ['./templates', __dirname]
|
||
|
}
|
||
|
}
|
||
|
})
|