Use rolldownOptions.output.globals
This commit is contained in:
@@ -21,7 +21,6 @@
|
|||||||
"matrix-web-i18n": "^3.6.0",
|
"matrix-web-i18n": "^3.6.0",
|
||||||
"matrix-widget-api": "^1.17.0",
|
"matrix-widget-api": "^1.17.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.6",
|
||||||
"rollup-plugin-external-globals": "^0.13.0",
|
|
||||||
"typescript": "^6.0.0",
|
"typescript": "^6.0.0",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-node-polyfills": "^0.28.0",
|
"vite-plugin-node-polyfills": "^0.28.0",
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
import externalGlobals from "rollup-plugin-external-globals";
|
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
||||||
|
|
||||||
@@ -33,6 +32,12 @@ export default defineConfig({
|
|||||||
external: ["react"],
|
external: ["react"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
output: {
|
||||||
|
globals: {
|
||||||
|
// Reuse React from the host app
|
||||||
|
react: "window.React",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -42,10 +47,6 @@ export default defineConfig({
|
|||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
include: ["events"],
|
include: ["events"],
|
||||||
}),
|
}),
|
||||||
externalGlobals({
|
|
||||||
// Reuse React from the host app
|
|
||||||
react: "window.React",
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
// Use production mode for the build as it is tested against production builds of Element Web,
|
// 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",
|
"@vitejs/plugin-react": "^5.0.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.6",
|
||||||
"react-dom": "19.2.6",
|
"react-dom": "19.2.6",
|
||||||
"rollup-plugin-external-globals": "^0.13.0",
|
|
||||||
"typescript": "^6.0.0",
|
"typescript": "^6.0.0",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-node-polyfills": "^0.28.0"
|
"vite-plugin-node-polyfills": "^0.28.0"
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
import externalGlobals from "rollup-plugin-external-globals";
|
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
@@ -31,6 +30,12 @@ export default defineConfig({
|
|||||||
external: ["react"],
|
external: ["react"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
output: {
|
||||||
|
globals: {
|
||||||
|
// Reuse React from the host app
|
||||||
|
react: "window.React",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
minify: false,
|
minify: false,
|
||||||
},
|
},
|
||||||
@@ -39,10 +44,6 @@ export default defineConfig({
|
|||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
include: ["events"],
|
include: ["events"],
|
||||||
}),
|
}),
|
||||||
externalGlobals({
|
|
||||||
// Reuse React from the host app
|
|
||||||
react: "window.React",
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
// Use production mode for the build as it is tested against production builds of Element Web,
|
// Use production mode for the build as it is tested against production builds of Element Web,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
"@vitejs/plugin-react": "^5.0.0",
|
"@vitejs/plugin-react": "^5.0.0",
|
||||||
"react": "19.2.6",
|
"react": "19.2.6",
|
||||||
"rollup-plugin-external-globals": "^0.13.0",
|
|
||||||
"typescript": "^6.0.0",
|
"typescript": "^6.0.0",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-node-polyfills": "^0.28.0"
|
"vite-plugin-node-polyfills": "^0.28.0"
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
import externalGlobals from "rollup-plugin-external-globals";
|
|
||||||
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
@@ -32,6 +31,12 @@ export default defineConfig({
|
|||||||
external: ["react"],
|
external: ["react"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
output: {
|
||||||
|
globals: {
|
||||||
|
// Reuse React from the host app
|
||||||
|
react: "window.React",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -40,10 +45,6 @@ export default defineConfig({
|
|||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
include: ["events"],
|
include: ["events"],
|
||||||
}),
|
}),
|
||||||
externalGlobals({
|
|
||||||
// Reuse React from the host app
|
|
||||||
react: "window.React",
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
// Use production mode for the build as it is tested against production builds of Element Web,
|
// 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/browser-playwright": "^4.0.0",
|
||||||
"@vitest/coverage-v8": "^4.0.0",
|
"@vitest/coverage-v8": "^4.0.0",
|
||||||
"react": "^19",
|
"react": "^19",
|
||||||
"rollup-plugin-external-globals": "^0.13.0",
|
|
||||||
"typescript": "^6.0.0",
|
"typescript": "^6.0.0",
|
||||||
"vite": "^8.0.0",
|
"vite": "^8.0.0",
|
||||||
"vite-plugin-node-polyfills": "^0.28.0",
|
"vite-plugin-node-polyfills": "^0.28.0",
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
import { defineConfig, esmExternalRequirePlugin } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
import { nodePolyfills } from "vite-plugin-node-polyfills";
|
||||||
import externalGlobals from "rollup-plugin-external-globals";
|
|
||||||
import svgr from "vite-plugin-svgr";
|
import svgr from "vite-plugin-svgr";
|
||||||
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
import { importCSSSheet } from "@arcmantle/vite-plugin-import-css-sheet";
|
||||||
|
|
||||||
@@ -33,6 +32,12 @@ export default defineConfig({
|
|||||||
external: ["react"],
|
external: ["react"],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
output: {
|
||||||
|
globals: {
|
||||||
|
// Reuse React from the host app
|
||||||
|
react: "window.React",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
@@ -42,10 +47,6 @@ export default defineConfig({
|
|||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
include: ["events"],
|
include: ["events"],
|
||||||
}),
|
}),
|
||||||
externalGlobals({
|
|
||||||
// Reuse React from the host app
|
|
||||||
react: "window.React",
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
// Use production mode for the build as it is tested against production builds of Element Web,
|
// Use production mode for the build as it is tested against production builds of Element Web,
|
||||||
|
|||||||
Reference in New Issue
Block a user