Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
asanehisa committed Apr 29, 2024
1 parent d9fcd88 commit b29660f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/pages/src/vite-plugin/modules/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down

0 comments on commit b29660f

Please sign in to comment.