mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-30 08:37:56 +09:00
experimental: SSG download support (#3783)
## Description See corresponding [SaaS PR](https://github.com/webstudio-is/webstudio-saas/pull/311) too ## Steps for reproduction Click Publish/Export <img width="363" alt="image" src="https://github.com/user-attachments/assets/fbc1f4e5-3a2c-4bb9-9242-025196f991bc"> Deploy zip to netlify <img width="1710" alt="image" src="https://github.com/user-attachments/assets/daca4ead-6272-4729-8e82-0986301e5c8b"> ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
This commit is contained in:
1 parent
1f435cc7f9
commit
8be665e68d
38 files changed
+701
-73
No files matched your search
@@ -296,11 +296,6 @@ export const prebuild = async (options: {
|
||||
);
|
||||
}
|
||||
|
||||
const domain = siteData.build.deployment?.projectDomain;
|
||||
if (domain === undefined) {
|
||||
throw new Error(`Project domain is missing from the project data`);
|
||||
}
|
||||
|
||||
// collect all possible component metas
|
||||
const metas = new Map<string, WsComponentMeta>();
|
||||
const componentSources = new Map<string, string>();
|
||||
@@ -448,6 +443,15 @@ export const prebuild = async (options: {
|
||||
const assetsToDownload: Promise<void>[] = [];
|
||||
|
||||
const appDomain = options.preview ? "wstd.work" : "wstd.io";
|
||||
|
||||
const domain =
|
||||
siteData.build.deployment?.destination === "static"
|
||||
? siteData.build.deployment?.assetsDomain
|
||||
: siteData.build.deployment?.projectDomain;
|
||||
if (domain === undefined) {
|
||||
throw new Error(`Project domain is missing from the project data`);
|
||||
}
|
||||
|
||||
const assetBuildUrl = `https://${domain}.${appDomain}/cgi/asset/`;
|
||||
|
||||
const imageLoader = createImageLoader({
|
||||
|
||||
@@ -9,5 +9,9 @@ export const imageBaseUrl = "/assets/";
|
||||
* @type {import("@webstudio-is/image").ImageLoader}
|
||||
*/
|
||||
export const imageLoader = ({ src }) => {
|
||||
if (URL.canParse(src)) {
|
||||
return src;
|
||||
}
|
||||
|
||||
return imageBaseUrl + src;
|
||||
};
|
||||
Reference in new issue
Block a user