Fix vite build to place element-call correctly for embedded npm package support

This commit is contained in:
Gigiaj 2025-05-22 23:53:17 -05:00
parent 4c8ab4e79d
commit d3ec9facf6

View file

@ -14,9 +14,9 @@ import buildConfig from './build.config';
const copyFiles = {
targets: [
{
src: 'node_modules/@element-hq/element-call-embedded/dist',
dest: 'element-call'
},
src: 'node_modules/@element-hq/element-call-embedded/dist/*',
dest: 'public/element-call',
},
{
src: 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs',
dest: '',
@ -51,7 +51,10 @@ function serverMatrixSdkCryptoWasm(wasmFilePath) {
configureServer(server) {
server.middlewares.use((req, res, next) => {
if (req.url === wasmFilePath) {
const resolvedPath = path.join(path.resolve(), "/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm");
const resolvedPath = path.join(
path.resolve(),
'/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm'
);
if (fs.existsSync(resolvedPath)) {
res.setHeader('Content-Type', 'application/wasm');
@ -106,8 +109,8 @@ export default defineConfig({
},
devOptions: {
enabled: true,
type: 'module'
}
type: 'module',
},
}),
],
optimizeDeps: {