Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: avoid imports of not installed packages when setup SSG (#4763)
Bogdan Chadkin79db5d8f359b
diff --git a/fixtures/ssg-netlify-by-project-id/app/constants.mjs b/fixtures/ssg-netlify-by-project-id/app/constants.mjsindex cee72e5d3a..1e1639f807 100644--- a/fixtures/ssg-netlify-by-project-id/app/constants.mjs+++ b/fixtures/ssg-netlify-by-project-id/app/constants.mjs@@ -2,7 +2,6 @@* We use mjs extension as constants in this file is shared with the build script* and we use `node --eval` to extract the constants.*/-import { UrlCanParse } from "@webstudio-is/image";export const assetBaseUrl = "/assets/";export const imageBaseUrl = "/assets/";@@ -11,10 +10,6 @@ export const imageBaseUrl = "/assets/";* @type {import("@webstudio-is/image").ImageLoader}*/export const imageLoader = (props) => {- if (UrlCanParse(props.src)) {- return props.src;- }-if (process.env.NODE_ENV !== "production") {return props.src;}diff --git a/packages/cli/templates/ssg-netlify/app/constants.mjs b/packages/cli/templates/ssg-netlify/app/constants.mjsindex cee72e5d3a..1e1639f807 100644--- a/packages/cli/templates/ssg-netlify/app/constants.mjs+++ b/packages/cli/templates/ssg-netlify/app/constants.mjs@@ -2,7 +2,6 @@* We use mjs extension as constants in this file is shared with the build script* and we use `node --eval` to extract the constants.*/-import { UrlCanParse } from "@webstudio-is/image";export const assetBaseUrl = "/assets/";export const imageBaseUrl = "/assets/";@@ -11,10 +10,6 @@ export const imageBaseUrl = "/assets/";* @type {import("@webstudio-is/image").ImageLoader}*/export const imageLoader = (props) => {- if (UrlCanParse(props.src)) {- return props.src;- }-if (process.env.NODE_ENV !== "production") {return props.src;}diff --git a/packages/cli/templates/ssg-vercel/app/constants.mjs b/packages/cli/templates/ssg-vercel/app/constants.mjsindex 6ec2f904e9..190f2a792d 100644--- a/packages/cli/templates/ssg-vercel/app/constants.mjs+++ b/packages/cli/templates/ssg-vercel/app/constants.mjs@@ -2,7 +2,6 @@* We use mjs extension as constants in this file is shared with the build script* and we use `node --eval` to extract the constants.*/-import { UrlCanParse } from "@webstudio-is/image";export const assetBaseUrl = "/assets/";export const imageBaseUrl = "/assets/";@@ -11,10 +10,6 @@ export const imageBaseUrl = "/assets/";* @type {import("@webstudio-is/image").ImageLoader}*/export const imageLoader = (props) => {- if (UrlCanParse(props.src)) {- return props.src;- }-if (process.env.NODE_ENV !== "production") {return props.src;}diff --git a/packages/image/src/image-optimize.ts b/packages/image/src/image-optimize.tsindex 770d1eee0a..d5db5e213f 100644--- a/packages/image/src/image-optimize.ts+++ b/packages/image/src/image-optimize.ts@@ -235,7 +235,7 @@ const DEFAULT_QUALITY = 80;/*** URL.canParse(props.src)*/-export const UrlCanParse = (url: string): boolean => {+const UrlCanParse = (url: string): boolean => {try {new URL(url);return true;