Skip to content

Commit

Permalink
ci: mark builf-time variables
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 12, 2024
1 parent 68a5bf5 commit 13d14d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 0 additions & 6 deletions packages/core/src/env.d.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/core/src/lazyLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function lazyLoad<T extends HTMLImageElement>(

// Generate the blurry placeholder from a Blurhash or ThumbHash string if applicable
if (
// @ts-expect-error: Build-time variable
(typeof __UNLAZY_HASH_DECODING__ === 'undefined' || __UNLAZY_HASH_DECODING__)
&& hash
) {
Expand All @@ -45,6 +46,7 @@ export function lazyLoad<T extends HTMLImageElement>(

// Bail if the image does not provide a `data-src` or `data-srcset` attribute
if (!image.dataset.src && !image.dataset.srcset) {
// @ts-expect-error: Build-time variable
if (typeof __UNLAZY_LOGGING__ === 'undefined' || __UNLAZY_LOGGING__)
console.error('[unlazy] Missing `data-src` or `data-srcset` attribute', image)
continue
Expand Down Expand Up @@ -179,6 +181,7 @@ export function createPlaceholderFromHash(
return createPngDataUriFromThumbHash(hash)
}
catch (error) {
// @ts-expect-error: Build-time variable
if (typeof __UNLAZY_LOGGING__ === 'undefined' || __UNLAZY_LOGGING__)
console.error(`[unlazy] Failed to generate ${hashType} placeholder:`, error)
}
Expand Down

0 comments on commit 13d14d8

Please sign in to comment.