Skip to content

Commit 0b480a1

Browse files
committed
refactor: Replace CDN references with bundled assets for vad-web static files.
1 parent 6ac0bf2 commit 0b480a1

5 files changed

Lines changed: 317 additions & 7 deletions

File tree

electron.vite.config.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { resolve } from 'path';
22
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
33
import react from '@vitejs/plugin-react';
4+
import { viteStaticCopy } from 'vite-plugin-static-copy'
5+
import path from 'path';
46

57
export default defineConfig({
68
main: {
@@ -15,7 +17,29 @@ export default defineConfig({
1517
'@': resolve('src/renderer/src'),
1618
},
1719
},
18-
plugins: [react()],
20+
plugins: [
21+
viteStaticCopy({
22+
targets: [
23+
{
24+
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js'),
25+
dest: './libs/',
26+
},
27+
{
28+
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx'),
29+
dest: './libs/',
30+
},
31+
{
32+
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx'),
33+
dest: './libs/',
34+
},
35+
{
36+
src: path.join(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm'),
37+
dest: './libs/',
38+
},
39+
],
40+
}),
41+
react(),
42+
],
1943
build: {
2044
rollupOptions: {
2145
onwarn(warning, warn) {

0 commit comments

Comments
 (0)