Skip to content

Commit f5f6fcf

Browse files
fix: webpack import meta error (#114)
I did some investigation about this and it turns out our transpiled JS code is the following (published package) here import.meta is accessed directly, however https://webpack.js.org/api/module-variables/ states that you cannot directly access import.meta instead, access its properties or de-structure it I believe this affects all projects using webpack and we might need to update the code for this function ![image](https://github.com/user-attachments/assets/8194609a-d417-48be-84f1-461a0b146fdf) ![image](https://github.com/user-attachments/assets/ea87730a-24c1-40d3-a95a-88b574f9b4e5) --------- Co-authored-by: BeroBurny <[email protected]>
1 parent efaaa2b commit f5f6fcf

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/sdk/src/node.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
interface ImportMeta {
2+
env: string;
3+
}

packages/sdk/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export function getEnv(envName: string, defaultValue: string): string {
33
try {
44
if (typeof process !== "undefined" && "env" in process)
55
variable = process.env[envName];
6-
else if ("env" in import.meta) {
6+
else if (import.meta.env) {
77
const env =
88
// @ts-expect-error @typescript-eslint/ban-ts-comment
99
(import.meta.env as { [key: string]: string | undefined }) || {};

0 commit comments

Comments
 (0)