-
Notifications
You must be signed in to change notification settings - Fork 116
/
vite.config.ts
48 lines (42 loc) · 1.21 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import path from 'node:path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
import topLevelAwait from 'vite-plugin-top-level-await';
import wasm from 'vite-plugin-wasm';
import { getFileList } from './tools/get_file_list';
const publicDir = path.resolve(__dirname, './public');
const getPublicFileList = async (targetPath: string) => {
const filePaths = await getFileList(targetPath);
const publicFiles = filePaths
.map((filePath) => path.relative(publicDir, filePath))
.map((filePath) => path.join('/', filePath));
return publicFiles;
};
export default defineConfig(async () => {
const videos = await getPublicFileList(path.resolve(publicDir, 'videos'));
return {
build: {
assetsInlineLimit: 20480,
cssCodeSplit: false,
cssTarget: 'es6',
minify: false,
rollupOptions: {
output: {
experimentalMinChunkSize: 40960,
},
},
target: 'es2015',
},
plugins: [
react(),
wasm(),
topLevelAwait(),
ViteEjsPlugin({
module: '/src/client/index.tsx',
title: '買えるオーガニック',
videos,
}),
],
};
});