File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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/'
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 }
You can’t perform that action at this time.
0 commit comments