Fix Module API versioning (#33233) (#33261)

* Fix Module API versioning

* Attempt #2

(cherry picked from commit fb263ee511b81a02e61dce466d3d4c23903a51f6)

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
ElementRobot 2026-04-22 10:30:46 +02:00 committed by GitHub
parent e80f9b287f
commit 368d9397f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,8 @@ import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import externalGlobals from "rollup-plugin-external-globals";
import packageJson from "./package.json" with { type: "json" };
const __dirname = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
@ -32,7 +34,9 @@ export default defineConfig({
}),
],
define: {
__VERSION__: JSON.stringify(process.env.npm_package_version),
// We cannot use `process.env.npm_package_version` as when building element-web with module-api set to `workspace`
// this would contain the version of element-web rather than that of the module-api.
__VERSION__: JSON.stringify(packageJson.version),
// 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" } },