Use rolldownOptions.output.globals

This commit is contained in:
Michael Telatynski
2026-06-04 11:36:15 +01:00
parent 2321dc8f63
commit 82b5397c7d
8 changed files with 24 additions and 24 deletions
-1
View File
@@ -21,7 +21,6 @@
"matrix-web-i18n": "^3.6.0",
"matrix-widget-api": "^1.17.0",
"react": "19.2.6",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "^6.0.0",
"vite": "^8.0.0",
"vite-plugin-node-polyfills": "^0.28.0",
+6 -5
View File
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
import { defineConfig, esmExternalRequirePlugin } 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";
@@ -33,6 +32,12 @@ export default defineConfig({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
},
plugins: [
@@ -42,10 +47,6 @@ 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,
@@ -24,7 +24,6 @@
"@vitejs/plugin-react": "^5.0.0",
"react": "19.2.6",
"react-dom": "19.2.6",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "^6.0.0",
"vite": "^8.0.0",
"vite-plugin-node-polyfills": "^0.28.0"
+6 -5
View File
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
import { defineConfig, esmExternalRequirePlugin } from "vite";
import react from "@vitejs/plugin-react";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import externalGlobals from "rollup-plugin-external-globals";
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -31,6 +30,12 @@ export default defineConfig({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
minify: false,
},
@@ -39,10 +44,6 @@ 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,
@@ -18,7 +18,6 @@
"@types/react": "^19",
"@vitejs/plugin-react": "^5.0.0",
"react": "19.2.6",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "^6.0.0",
"vite": "^8.0.0",
"vite-plugin-node-polyfills": "^0.28.0"
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
import { defineConfig, esmExternalRequirePlugin } from "vite";
import react from "@vitejs/plugin-react";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import externalGlobals from "rollup-plugin-external-globals";
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -32,6 +31,12 @@ export default defineConfig({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
},
plugins: [
@@ -40,10 +45,6 @@ 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,
@@ -23,7 +23,6 @@
"@vitest/browser-playwright": "^4.0.0",
"@vitest/coverage-v8": "^4.0.0",
"react": "^19",
"rollup-plugin-external-globals": "^0.13.0",
"typescript": "^6.0.0",
"vite": "^8.0.0",
"vite-plugin-node-polyfills": "^0.28.0",
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
import { defineConfig, esmExternalRequirePlugin } 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";
@@ -33,6 +32,12 @@ export default defineConfig({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
},
plugins: [
@@ -42,10 +47,6 @@ 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,