-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvite.config.mjs
72 lines (69 loc) · 1.78 KB
/
vite.config.mjs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { resolve } from 'node:path';
import react from '@vitejs/plugin-react';
import mediaMinMax from 'postcss-media-minmax';
import { defineConfig, normalizePath } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import svgr from 'vite-plugin-svgr';
import topLevelAwait from 'vite-plugin-top-level-await';
const URL = process.env.VITE_PUBLIC_URL || '';
// https://vitejs.dev/config/
export default defineConfig({
...(URL ? { base: URL } : {}),
root: resolve(__dirname, 'src/renderer/'),
build: {
cssTarget: ['chrome100'],
sourcemap: true,
/*rollupOptions: {
input: {
main: resolve(__dirname, 'src/renderer/index.html'),
},
},*/
outDir: resolve(__dirname, 'out/web/'),
},
optimizeDeps: {
exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util"],
},
resolve: {
alias: {
'~': resolve(__dirname),
},
},
css: {
postcss: {
plugins: [mediaMinMax],
},
},
plugins: [
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`,
}),
react(),
svgr({
include: '**/*.svg?jsx',
svgrOptions: {
// svgr options
},
}),
viteStaticCopy({
targets: [
{
src: normalizePath(resolve(__dirname, './resources/*')),
dest: '.',
},
{
src: normalizePath(resolve(__dirname, 'node_modules/@ffmpeg/core/dist/esm/*')),
dest: '.',
},
],
}),
],
server: {
headers: {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
},
},
});