Files
element-call-Github/vite-embedded.config.js
Hugh Nimmo-Smith 7aac56aac0 Vite embedded build of Element Call (#3077)
* Embedded package build of Element Call

Part of https://github.com/element-hq/element-call/issues/2994

This creates a new "embedded" build (vs "full" build) at the vite level. It will be used by a later PR that actually provides platform specific packages.

Embedded build:

- Uses relative URLs
- Uses relative config.json path and other resource loading
- Has a config.json built in
- Doesn't include the public folder (e.g. favicon)

Out of scope:

- this doesn't attempt to exclude SPA functionality, so technically the build could be used in SPA
- the above means that the crypto-wasm binary is included in the build

* CI artifact name based on type of build

* Update src/config/Config.ts
2025-03-12 17:00:44 +00:00

32 lines
953 B
JavaScript

import { defineConfig, mergeConfig } from "vite";
import fullConfig from "./vite.config";
import generateFile from "vite-plugin-generate-file";
const base = "./";
// Config for embedded deployments (possibly hosted under a non-root path)
export default defineConfig((env) =>
mergeConfig(
fullConfig({ ...env, packageType: "embedded" }),
defineConfig({
base, // Use relative URLs to allow the app to be hosted under any path
publicDir: false, // Don't serve the public directory which only contains the favicon
plugins: [
generateFile([
{
type: "json",
output: "./config.json",
data: {
matrix_rtc_session: {
key_rotation_on_leave_delay: 15000,
membership_keep_alive_period: 5000,
membership_server_side_expiry_timeout: 15000,
},
},
},
]),
],
}),
),
);