-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.js
53 lines (51 loc) · 1.24 KB
/
vite.config.js
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
import { defineConfig } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy'
const { resolve } = require('path');
const fs = require('fs');
function generateInputOption() {
let input = {
404: resolve(__dirname, '_site', '404.html'),
links: resolve(__dirname, '_site', 'links', 'index.html'),
main: resolve(__dirname, '_site', 'index.html'),
blog: resolve(__dirname, '_site', 'blog', 'index.html'),
};
const paths = fs
.readdirSync('src/blog', { withFileTypes: false })
.filter(function isNotAFileType(dir) {
return dir.search('.html') === -1;
});
paths.forEach((element) => {
element = element.split('.')[0];
input['blog/' + element] = resolve(
__dirname,
'_site',
'blog',
element,
'index.html',
);
});
console.log(input)
return input;
}
export default defineConfig(({ command, mode, ssrBuild }) => {
return {
root: '_site',
build: {
outDir: '../dist',
rollupOptions: {
input: generateInputOption(),
},
emptyOutDir: true,
},
plugins: [
viteStaticCopy({
targets: [
{
src: 'well-known/nostr.json',
dest: '.well-known'
},
]
})
]
}
});