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
+6 -1
View File
@@ -19,10 +19,15 @@
"types": "./lib/element-web-module-api-alpha.d.ts",
"import": "./lib/element-web-plugin-engine.js",
"require": "./lib/element-web-plugin-engine.umd.cjs"
},
"./vite.base.ts": {
"types": "./vite.base.ts",
"import": "./vite.base.ts"
}
},
"files": [
"lib"
"lib",
"vite.base.ts"
],
"scripts": {
"prepack": "nx build",
+46
View File
@@ -0,0 +1,46 @@
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
/**
* Base vite config for building Element modules
*/
import { defineConfig, esmExternalRequirePlugin } from "vite";
import externalGlobals from "rollup-plugin-external-globals";
export default defineConfig({
build: {
outDir: "lib",
target: "esnext",
sourcemap: true,
rolldownOptions: {
plugins: [
esmExternalRequirePlugin({
external: ["react"],
}),
],
output: {
globals: {
// Reuse React from the host app
react: "window.React",
},
},
},
},
plugins: [
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" } },
},
});