File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 11import { defineConfig , normalizePath } from 'vite' ;
22import path from 'path' ;
33import 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 }
You can’t perform that action at this time.
0 commit comments