72018aa389
Configures vite-plugin-static-copy to serve @ricky0123/vad-web's ONNX model, audio worklet, and onnxruntime-web WASM files from the site root. useOnnxPreloader warms the model cache during page idle so the first mic click is instant. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
import { resolve } from "path";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
// @ricky0123/vad-web ships ONNX + audio-worklet assets and depends on
|
|
// onnxruntime-web's WASM binaries. Copy them into the served root so
|
|
// MicVAD can load them at runtime via `baseAssetPath: "/"`.
|
|
viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: "node_modules/@ricky0123/vad-web/dist/*.onnx",
|
|
dest: "",
|
|
rename: { stripBase: true },
|
|
},
|
|
{
|
|
src: "node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js",
|
|
dest: "",
|
|
rename: { stripBase: true },
|
|
},
|
|
{
|
|
src: "node_modules/onnxruntime-web/dist/*.wasm",
|
|
dest: "",
|
|
rename: { stripBase: true },
|
|
},
|
|
{
|
|
src: "node_modules/onnxruntime-web/dist/*.mjs",
|
|
dest: "",
|
|
rename: { stripBase: true },
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": "http://localhost:5000",
|
|
},
|
|
},
|
|
});
|