Skip to content

Commit 614f557

Browse files
committed
fix: copy plugin compatible with Windows and Mac.
1 parent 0b480a1 commit 614f557

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

electron.vite.config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
33
import react from '@vitejs/plugin-react';
44
import { viteStaticCopy } from 'vite-plugin-static-copy'
55
import path from 'path';
6+
import { normalizePath } from 'vite';
67

78
export default defineConfig({
89
main: {
@@ -21,19 +22,19 @@ export default defineConfig({
2122
viteStaticCopy({
2223
targets: [
2324
{
24-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js'),
25+
src: normalizePath(resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js')),
2526
dest: './libs/',
2627
},
2728
{
28-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx'),
29+
src: normalizePath(resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx')),
2930
dest: './libs/',
3031
},
3132
{
32-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx'),
33+
src: normalizePath(resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx')),
3334
dest: './libs/',
3435
},
3536
{
36-
src: path.join(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm'),
37+
src: normalizePath(resolve(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm')),
3738
dest: './libs/',
3839
},
3940
],

vite.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig } from 'vite';
1+
import { defineConfig, normalizePath } from 'vite';
22
import path from 'path';
33
import react from '@vitejs/plugin-react-swc';
44
import { viteStaticCopy } from 'vite-plugin-static-copy'
@@ -8,19 +8,19 @@ const createConfig = (outDir: string) => ({
88
viteStaticCopy({
99
targets: [
1010
{
11-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js'),
11+
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js')),
1212
dest: './libs/'
1313
},
1414
{
15-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx'),
15+
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_v5.onnx')),
1616
dest: './libs/'
1717
},
1818
{
19-
src: path.join(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx'),
19+
src: normalizePath(path.resolve(__dirname, 'node_modules/@ricky0123/vad-web/dist/silero_vad_legacy.onnx')),
2020
dest: './libs/'
2121
},
2222
{
23-
src: path.join(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm'),
23+
src: normalizePath(path.resolve(__dirname, 'node_modules/onnxruntime-web/dist/*.wasm')),
2424
dest: './libs/'
2525
}
2626
],

0 commit comments

Comments
 (0)