Skip to content

Commit 8d664f9

Browse files
committed
Update vite.config.ts
1 parent 92c36de commit 8d664f9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

vite.config.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
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/'
25-
}
23+
dest: './libs/',
24+
},
2625
],
2726
}),
2827
react(),
@@ -48,9 +47,12 @@ const createConfig = (outDir: string) => ({
4847
},
4948
},
5049
},
50+
ssr: {
51+
noExternal: ['vite-plugin-static-copy'],
52+
},
5153
});
5254

53-
export default defineConfig(({ mode }) => {
55+
export default defineConfig(async ({ mode }) => {
5456
if (mode === 'web') {
5557
return createConfig('dist/web');
5658
}

0 commit comments

Comments
 (0)