Skip to content

Commit 152feff

Browse files
lopertsaulecabrera
authored andcommitted
use try/catch to handle undefined global
1 parent b274d57 commit 152feff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

run.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ declare global {
1414
export default function <I extends {}, O extends {}>(
1515
userfunction: UserFunction<I, O>
1616
) {
17-
if (!ShopifyFunction) {
17+
try {
18+
ShopifyFunction;
19+
} catch (e) {
1820
throw new Error(
1921
"ShopifyFunction is not defined. Please rebuild your function using the latest version of Shopify CLI."
2022
);

0 commit comments

Comments
 (0)