diff --git a/index.html b/index.html index 3d1d48b..8af8769 100644 --- a/index.html +++ b/index.html @@ -32,7 +32,7 @@ href="https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=Space+Grotesk:wght@400;600;700&display=swap" /> - + diff --git a/src/app/components/message/RenderBody.tsx b/src/app/components/message/RenderBody.tsx index ef57315..8f606f3 100644 --- a/src/app/components/message/RenderBody.tsx +++ b/src/app/components/message/RenderBody.tsx @@ -6,8 +6,6 @@ import { MessageEmptyContent } from './content'; import { sanitizeCustomHtml } from '../../utils/sanitize'; import { highlightText, scaleSystemEmoji } from '../../plugins/react-custom-html-parser'; import { isMxEmoticonOnlyHtml } from '../../utils/regex'; -// Ensure jumbo emoji global styles are always in the bundle. -import './layout/layout.css'; type RenderBodyProps = { body: string; diff --git a/vite.config.js b/vite.config.js index 7d3faf7..a7efe65 100644 --- a/vite.config.js +++ b/vite.config.js @@ -136,6 +136,21 @@ function servePublicAssets() { } // CORS proxy for Matrix homeservers during development +/** + * Vite adds crossorigin to module/CSS tags when base is relative (./). + * Electron serves the build via file:// — those assets then fail CORS checks + * and the app renders with browser defaults (black text, broken spacing). + */ +function stripCrossoriginForFileProtocol() { + return { + name: 'strip-crossorigin-for-file-protocol', + apply: 'build', + transformIndexHtml(html) { + return html.replace(/\s+crossorigin/g, ''); + }, + }; +} + function corsProxyMiddleware() { return { name: 'vite-plugin-cors-proxy', @@ -228,6 +243,7 @@ export default defineConfig({ }, }, plugins: [ + stripCrossoriginForFileProtocol(), corsProxyMiddleware(), // Add CORS proxy for development serverMatrixSdkCryptoWasm('/node_modules/.vite/deps/pkg/matrix_sdk_crypto_wasm_bg.wasm'), serveGifWorker(),