Update vite.config.mjs

This commit is contained in:
谷風天音 | 是一个浓度纯度都比较高的柚子厨,因为柚子社天下第一!时不时发柚子的癫。有个能干的妹妹真好,たにかぜ あまね天下第一喵,关注谷風天音谢谢喵,关注谷風天音谢谢喵,谢谢在这里看我发癫,天音妹妹真的好好看喵,单推天音一辈子!谁不推天音就打爆他的宁宁的起爆器!\柚子社/\柚子社/\柚子社/\天音/\天音/\天音/天音,我真的好喜欢你啊,为了你,我要 0721!\たにかぜ あまね/\たにかぜ あまね/\たにかぜ あまね/\たにかぜ あまね/\たにかぜ あまね/\たにかぜ あまね/\たにかぜ あまね/ 2023-03-29 13:05:37 +08:00 committed by GitHub
parent 5dda93bafb
commit 9c6750e1a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -12,7 +12,24 @@ export default defineConfig({
sourcemap: false,
rollupOptions: {
input: {
'index.html': resolve(sourceDirectory, 'index.html')
...(() => {
const scanFolder: (folder: string, accu: string[]) => void = (folder, accu) => {
const files = fs.readdirSync(folder).map(f => resolve(folder, f))
files.filter(f => fs.lstatSync(f).isFile()).forEach(f => accu.push(f))
files.filter(f => fs.lstatSync(f).isDirectory()).forEach(f => scanFolder(f, accu))
}
const files: string[] = []
scanFolder('./public', files)
const output: any = {}
for(const i of files.filter((it) => it.endsWith(".html"))) {
output[parse(i).name] = i
}
return output
})()
}
}
}