cleanup vite.configs and simplify exported sdk props.

This commit is contained in:
Timo K
2025-12-02 11:31:56 +01:00
parent f76a6cb599
commit 93de12d79c
8 changed files with 933 additions and 88 deletions

View File

@@ -27,7 +27,7 @@ import * as fs from "node:fs";
export default ({
mode,
packageType,
}: ConfigEnv & { packageType?: "full" | "embedded" | "sdk" }): UserConfig => {
}: ConfigEnv & { packageType?: "full" | "embedded" }): UserConfig => {
const env = loadEnv(mode, process.cwd());
// Environment variables with the VITE_ prefix are accessible at runtime.
// So, we set this to allow for build/package specific behavior.
@@ -68,7 +68,7 @@ export default ({
plugins.push(
createHtmlPlugin({
entry: packageType === "sdk" ? "sdk/main.ts" : "src/main.tsx",
entry: "src/main.tsx",
inject: {
data: {
brand: env.VITE_PRODUCT_NAME || "Element Call",
@@ -125,15 +125,10 @@ export default ({
// Default naming fallback
return "assets/[name]-[hash][extname]";
},
manualChunks:
packageType !== "sdk"
? {
// we should be able to remove this one https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/pull/167 lands
"matrix-sdk-crypto-wasm": [
"@matrix-org/matrix-sdk-crypto-wasm",
],
}
: undefined,
manualChunks: {
// we should be able to remove this one https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/pull/167 lands
"matrix-sdk-crypto-wasm": ["@matrix-org/matrix-sdk-crypto-wasm"],
},
},
},
},