diff --git a/.changeset/small-taxes-heal.md b/.changeset/small-taxes-heal.md new file mode 100644 index 00000000000..aad6d1fc270 --- /dev/null +++ b/.changeset/small-taxes-heal.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Fix process not defined error when using "thirdweb/contract" import in Vite diff --git a/packages/thirdweb/src/utils/any-evm/zksync/constants.ts b/packages/thirdweb/src/utils/any-evm/zksync/constants.ts index b980b009b54..074c580eb6e 100644 --- a/packages/thirdweb/src/utils/any-evm/zksync/constants.ts +++ b/packages/thirdweb/src/utils/any-evm/zksync/constants.ts @@ -3,9 +3,10 @@ export const ZKSYNC_SINGLETON_FACTORY = export const CONTRACT_DEPLOYER_ADDRESS = "0x0000000000000000000000000000000000008006" as const; export const KNOWN_CODES_STORAGE = "0x0000000000000000000000000000000000008004"; -export const PUBLISHED_PRIVATE_KEY = process - ? process.env.ZKSYNC_PUBLISHED_PRIVATE_KEY - : undefined; +export const PUBLISHED_PRIVATE_KEY = + typeof process !== "undefined" && process && process.env + ? process.env.ZKSYNC_PUBLISHED_PRIVATE_KEY + : undefined; export const singletonFactoryAbi = [ "function deploy(bytes32,bytes32,bytes) external payable",