mtp/example/web-client/vite.config.ts
Alois 89a20044a5
Some checks failed
CI / rustfmt (push) Successful in 17s
CI / clippy (push) Failing after 1m16s
CI / wasm build (push) Successful in 1m17s
CI / example (push) Successful in 1m29s
CI / test (push) Successful in 1m49s
CI / duplicate code (push) Successful in 12s
CI / web client (push) Failing after 27s
CI / cargo-machete (push) Successful in 1m10s
CI / cargo-deny (push) Failing after 2m20s
(feat): rename example-usage to just example
(feat): add the example's web-client dist folder to a gitignore
(fix): format issues
(fix): a lot of duplicate code
2026-06-27 03:20:25 +02:00

28 lines
747 B
TypeScript

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: {
'mtp-wasm': path.resolve(__dirname, '../../wasm/pkg'),
},
},
server: {
https: hasDevCert
? {
cert: fs.readFileSync(certPath),
key: fs.readFileSync(keyPath),
}
: undefined,
fs: {
allow: ['.', path.resolve(__dirname, '../../wasm/pkg')],
},
},
});