-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
29 lines (25 loc) · 942 Bytes
/
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
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, loadEnv } from 'vite';
import dynamicImport from 'vite-plugin-dynamic-import';
import path from 'path';
import fs from 'fs';
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd(), '') };
!fs.existsSync(path.join(__dirname, "static", "blog")) && fs.symlinkSync(path.join(__dirname, process.env.BLOG_STATIC), path.join(__dirname, "static", "blog"), 'junction');
return defineConfig({
plugins: [sveltekit(), dynamicImport()],
ignore: ['**/*.adoc'],
resolve: {
alias: {
'@blogposts': path.join(__dirname, process.env.BLOG_PATH)
}
},
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ['.' + process.env.BLOG_PATH, '.' + process.env.BLOG_STATIC]
}
},
beforeBuild: [`node blogstatic.sync.js ${ path.join(__dirname, process.env.BLOG_STATIC)}`]
});
};