Some checks failed
CI / rustfmt (push) Successful in 17s
CI / wasm build (push) Successful in 1m16s
CI / clippy (push) Successful in 1m28s
CI / test (push) Successful in 1m48s
CI / example (push) Successful in 1m31s
CI / duplicate code (push) Failing after 33s
CI / web client (push) Failing after 34s
CI / cargo-machete (push) Successful in 1m18s
CI / cargo-deny (push) Failing after 3m2s
22 lines
664 B
TypeScript
22 lines
664 B
TypeScript
import { defineConfig } from 'vite';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { mtp } from 'mtp/vite';
|
|
|
|
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({
|
|
plugins: [mtp({ typeMaps: '../../example/type-maps.yaml' })],
|
|
server: {
|
|
https: hasDevCert
|
|
? {
|
|
cert: fs.readFileSync(certPath),
|
|
key: fs.readFileSync(keyPath),
|
|
}
|
|
: undefined,
|
|
},
|
|
});
|