Fix Module API versioning (#33233)

* Fix Module API versioning

* Attempt #2
This commit is contained in:
Michael Telatynski 2026-04-21 22:47:07 +01:00 committed by GitHub
parent 8fa7b5ca2c
commit fb263ee511
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" } },