const CopyPlugin = require('copy-webpack-plugin'); | |
/** @type {import('next').NextConfig} */ | |
const nextConfig = { | |
output: "standalone", | |
// Custom Webpack configuration | |
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => { | |
// Add the node-loader for handling .node files | |
config.module.rules.push({ | |
test: /\.node$/, | |
loader: 'node-loader', | |
}); | |
// Add CopyPlugin to copy VAD assets | |
config.plugins.push( | |
new CopyPlugin({ | |
patterns: [ | |
{ | |
from: "node_modules/@ricky0123/vad-web/dist/vad.worklet.bundle.min.js", | |
to: "static/chunks/[name][ext]", // Adjusted path | |
}, | |
{ | |
from: "node_modules/@ricky0123/vad-web/dist/*.onnx", | |
to: "static/chunks/[name][ext]", // Adjusted path | |
}, | |
{ | |
from: "node_modules/onnxruntime-web/dist/*.wasm", | |
to: "static/chunks/[name][ext]" // Adjusted path | |
}, | |
], | |
}) | |
); | |
// Return the modified config | |
return config; | |
}, | |
} | |
module.exports = nextConfig; | |