[Fix] Connection issues in example-usage & wasm

This commit is contained in:
Alois 2026-06-25 18:31:11 +02:00
commit 3332aa621b
13 changed files with 356 additions and 55 deletions

View file

@ -1,6 +1,13 @@
import { defineConfig } from 'vite';
import fs from 'fs';
import path from 'path';
const devCertDir = path.resolve(__dirname, '../dev-cert');
const certPath = process.env.MTP_DEV_CERT ?? path.join(devCertDir, 'cert.pem');
const keyPath = process.env.MTP_DEV_KEY ?? path.join(devCertDir, 'key.pem');
const hasDevCert = fs.existsSync(certPath) && fs.existsSync(keyPath);
export default defineConfig({
resolve: {
alias: {
@ -8,6 +15,12 @@ export default defineConfig({
},
},
server: {
https: hasDevCert
? {
cert: fs.readFileSync(certPath),
key: fs.readFileSync(keyPath),
}
: undefined,
fs: {
allow: ['.', path.resolve(__dirname, '../../wasm/pkg')],
},