This commit is contained in:
Michael Telatynski
2026-06-08 11:19:13 +01:00
parent 2fc6eb717d
commit cf9ee41d06
16 changed files with 129 additions and 138 deletions
+1 -7
View File
@@ -7,12 +7,7 @@
"license": "SEE LICENSE IN README.md",
"scripts": {
"build": "vite build",
"lint": "pnpm lint:types && pnpm lint:js",
"lint:types": "tsc --noEmit",
"lint:js": "eslint --max-warnings 0 src -c ../.eslintrc.cjs",
"test:playwright": "playwright test -c ../playwright.config.ts",
"test:playwright:open": "yarn test:playwright -c ../playwright.config.ts --ui",
"test:playwright:screenshots": "playwright-screenshots yarn test:playwright --update-snapshots --grep @screenshot"
"lint:types": "tsc --noEmit"
},
"devDependencies": {
"@arcmantle/vite-plugin-import-css-sheet": "^1.0.12",
@@ -24,7 +19,6 @@
"matrix-web-i18n": "^3.6.0",
"matrix-widget-api": "^1.17.0",
"react": "catalog:",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "catalog:",
"vite": "catalog:",
"vite-plugin-node-polyfills": "catalog:",
+3 -29
View File
@@ -7,16 +7,16 @@ Please see LICENSE files in the repository root for full details.
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig, esmExternalRequirePlugin } from "vite";
import { mergeConfig } from "vite";
import react from "@vitejs/plugin-react";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import externalGlobals from "rollup-plugin-external-globals";
import svgr from "vite-plugin-svgr";
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
import baseConfig from "@element-hq/element-web-module-api/vite.base.ts";
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
export default mergeConfig(baseConfig, {
build: {
lib: {
entry: resolve(__dirname, "src/index.tsx"),
@@ -24,22 +24,6 @@ export default defineConfig({
fileName: "index",
formats: ["es"],
},
outDir: "lib",
target: "esnext",
sourcemap: true,
rolldownOptions: {
plugins: [
esmExternalRequirePlugin({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
},
plugins: [
importCSSSheet(),
@@ -48,15 +32,5 @@ export default defineConfig({
nodePolyfills({
include: ["events"],
}),
externalGlobals({
// Reuse React from the host app
react: "window.React",
}),
],
define: {
// Use production mode for the build as it is tested against production builds of Element Web,
// this is required for React JSX versions to be compatible.
"process.env.NODE_ENV": "'production'",
"process": { env: { NODE_ENV: "production" } },
},
});