You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unlazy ships with the [BlurHash](/placeholders/blurhash) and [ThumbHash](/placeholders/thumbhash) decoding algorithms to decode the hash values into images.
14
-
15
-
In case your project doesn't use these placeholders, you can disable the hash decoding algorithms to reduce the bundle size. Use the following build flags to tree-shake the hash decoding algorithms:
16
-
17
-
-`__ENABLE_HASH_DECODING__`: This flag is set to `true` by default.
18
-
19
11
As an example, you can tree-shake the hash decoding algorithms in Vite by setting the `define` option in your `vite.config.ts` file:
20
12
21
13
```ts
@@ -24,13 +16,36 @@ import { defineConfig } from 'vite'
unlazy ships with the [BlurHash](/placeholders/blurhash) and [ThumbHash](/placeholders/thumbhash) decoding algorithms to decode the hash values into images.
30
+
31
+
In case your project doesn't use these placeholders, you can disable the hash decoding algorithms to reduce the bundle size. Use the following build flags to tree-shake the hash decoding algorithms:
32
+
33
+
-`__UNLAZY_HASH_DECODING__`: This flag is set to `true` by default.
34
+
32
35
::: warning
33
36
This will only tree-shake the BlurHash and ThumbHash decoding algorithms when using the [`lazyLoad`](/api/lazy-load) method.
34
37
35
38
If you use either `unlazy/blurhash` or `unlazy/thumbhash` sub-path imports directly, the decoding algorithms will still be bundled.
unlazy will help you locate missing `data-src` or `data-srcset` attributes in your project by logging a warning in the browser console. An example warning message looks like this:
44
+
45
+
```bash
46
+
[unlazy] Missing `data-src` or `data-srcset` attribute: <img>
47
+
```
48
+
49
+
If you want to disable these warnings, you can use the following build flag:
50
+
51
+
-`__UNLAZY_LOGGING__`: This flag is set to `true` by default.
0 commit comments