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
This commit is contained in:
@@ -7,16 +7,15 @@ Please see LICENSE in the repository root for full details.
|
||||
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import svgrPlugin from "vite-plugin-svgr";
|
||||
import htmlTemplate from "vite-plugin-html-template";
|
||||
import { createHtmlPlugin } from "vite-plugin-html";
|
||||
import { codecovVitePlugin } from "@codecov/vite-plugin";
|
||||
import { sentryVitePlugin } from "@sentry/vite-plugin";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import basicSsl from "@vitejs/plugin-basic-ssl";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ mode }) => {
|
||||
export default defineConfig(({ mode, packageType }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
|
||||
const plugins = [
|
||||
react(),
|
||||
basicSsl(),
|
||||
@@ -27,9 +26,14 @@ export default defineConfig(({ mode }) => {
|
||||
ref: true,
|
||||
},
|
||||
}),
|
||||
htmlTemplate.default({
|
||||
data: {
|
||||
brand: env.VITE_PRODUCT_NAME || "Element Call",
|
||||
|
||||
createHtmlPlugin({
|
||||
entry: "src/main.tsx",
|
||||
inject: {
|
||||
data: {
|
||||
brand: env.VITE_PRODUCT_NAME || "Element Call",
|
||||
packageType: packageType ?? "full",
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user