A Wasm implementation of JPEG XL is 174 kB, and a minimal implementation (reflecting the libjxl-tiny encoder) can be done in somewhere around 25-50 kB. Wasm is rather performant and can render both normal and HDR JPEG XL's in browsers.
(As I understand it – and this is not much –, libjxl returns a bitmap and an ICC profile, which then has to be matched against the color space of the display. How is this going to work in a WASM decoder inside the browser? Or does it just render in sRGB, hoping for the best?)