diff --git a/.changeset/nervous-sloths-wash.md b/.changeset/nervous-sloths-wash.md new file mode 100644 index 0000000000..adb8387c3d --- /dev/null +++ b/.changeset/nervous-sloths-wash.md @@ -0,0 +1,5 @@ +--- +'@shopify/cli-kit': patch +--- + +Fix a bug when building empty theme assets diff --git a/packages/cli-kit/src/public/node/themes/factories.ts b/packages/cli-kit/src/public/node/themes/factories.ts index 02d5605de0..7652c09ef1 100644 --- a/packages/cli-kit/src/public/node/themes/factories.ts +++ b/packages/cli-kit/src/public/node/themes/factories.ts @@ -12,7 +12,8 @@ interface RemoteThemeResponse { interface RemoteAssetResponse { key: string checksum: string - attachment: string + attachment: string | undefined + // value is an empty string ('') when the file is empty value: string } @@ -52,8 +53,7 @@ export function buildThemeAsset(asset?: RemoteAssetResponse): ThemeAsset | undef const {key, checksum, attachment, value} = asset // Note: for attachments, this is the size of the base64 string, not the real length of the file - const stats = {size: (value || attachment).length, mtime: Date.now()} - + const stats = {size: (value || attachment || '').length, mtime: Date.now()} return {key, checksum, attachment, value, stats} }