Skip to content

Commit 4540da2

Browse files
committed
Fix Module API versioning
1 parent 3f3ed93 commit 4540da2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/module-api/vite.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { defineConfig } from "vite";
1111
import dts from "vite-plugin-dts";
1212
import externalGlobals from "rollup-plugin-external-globals";
1313

14+
import { version } from "./package.json" with { type: "json" };
15+
1416
const __dirname = dirname(fileURLToPath(import.meta.url));
1517

1618
export default defineConfig({
@@ -32,7 +34,9 @@ export default defineConfig({
3234
}),
3335
],
3436
define: {
35-
__VERSION__: JSON.stringify(process.env.npm_package_version),
37+
// We cannot use `process.env.npm_package_version` as when building element-web with module-api set to `workspace`
38+
// this would contain the version of element-web rather than that of the module-api.
39+
__VERSION__: JSON.stringify(version),
3640
// Use production mode for the build as it is tested against production builds of Element Web,
3741
// this is required for React JSX versions to be compatible.
3842
process: { env: { NODE_ENV: "production" } },

0 commit comments

Comments
 (0)