Skip to content

Commit b7ce7e5

Browse files
committed
Update vite.config.ts
1 parent 1f61304 commit b7ce7e5

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

vite.config.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
import { defineConfig, normalizePath } from 'vite';
22
import path from 'path';
33
import react from '@vitejs/plugin-react-swc';
4-
import { viteStaticCopy } from 'vite-plugin-static-copy'
54

6-
const createConfig = (outDir: string) => ({
5+
const createConfig = async (outDir: string) => ({
76
plugins: [
8-
viteStaticCopy({
7+
(await import('vite-plugin-static-copy')).viteStaticCopy({
98
targets: [
109
{
1110
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js')),
12-
dest: './libs/'
11+
dest: './libs/',
1312
},
1413
{
1514
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx')),
16-
dest: './libs/'
15+
dest: './libs/',
1716
},
1817
{
1918
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx')),
20-
dest: './libs/'
19+
dest: './libs/',
2120
},
2221
{
2322
src: normalizePath(path.resolve(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm')),
24-
dest: './libs/'
23+
dest: './libs/',
2524
},
2625
{
2726
src: normalizePath(path.resolve(__dirname, 'src/renderer/WebSDK/Core/live2dcubismcore.js')),
28-
dest: './libs/'
29-
}
27+
dest: './libs/',
28+
},
3029
],
3130
}),
3231
react(),
@@ -60,9 +59,12 @@ const createConfig = (outDir: string) => ({
6059
},
6160
},
6261
},
62+
ssr: {
63+
noExternal: ['vite-plugin-static-copy'],
64+
},
6365
});
6466

65-
export default defineConfig(({ mode }) => {
67+
export default defineConfig(async ({ mode }) => {
6668
if (mode === 'web') {
6769
return createConfig('dist/web');
6870
}

0 commit comments

Comments
 (0)