diff --git a/packages/pages/src/vite-plugin/modules/plugin.ts b/packages/pages/src/vite-plugin/modules/plugin.ts index e5aabdafd..5a4a6b252 100644 --- a/packages/pages/src/vite-plugin/modules/plugin.ts +++ b/packages/pages/src/vite-plugin/modules/plugin.ts @@ -95,10 +95,14 @@ export const buildModules = async ( renderBuiltUrl(filename, { type }) { let domain = `http://localhost:8000`; if (typeof process.env.YEXT_SITE_ARGUMENT !== "undefined") { - domain = new URL( - "http://" + - JSON.parse(process.env.YEXT_SITE_ARGUMENT).productionDomain - ).toString(); + try { + domain = new URL( + "https://" + + JSON.parse(process.env.YEXT_SITE_ARGUMENT).productionDomain + ).toString(); + } catch (_) { + logger.error("Cannot parse YEXT_SITE_ARGUMENT"); + } } if (type === "asset" && domain) { return `${domain}/${subfolders.modules}/${filename}`;