Skip to content

Commit 4f7eb26

Browse files
authored
fix: avoid optimizing .ico in docker template (#5368)
IPX we use for image generation does not support .ico format and fails to process it. Here I just skip image optimization for .ico and pass url directly.
1 parent 76c436c commit 4f7eb26

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

fixtures/react-router-docker/app/constants.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export const imageLoader = (props) => {
2424
if (props.format === "raw") {
2525
return props.src;
2626
}
27+
// IPX (sharp) does not support ico
28+
if (props.src.endsWith(".ico")) {
29+
return props.src;
30+
}
2731
// handle absolute urls
2832
const path = UrlCanParse(props.src) ? `/${props.src}` : props.src;
2933
// https://github.com/unjs/ipx?tab=readme-ov-file#modifiers

packages/cli/templates/react-router-docker/app/constants.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export const imageLoader = (props) => {
2424
if (props.format === "raw") {
2525
return props.src;
2626
}
27+
// IPX (sharp) does not support ico
28+
if (props.src.endsWith('.ico')) {
29+
return props.src;
30+
}
2731
// handle absolute urls
2832
const path = UrlCanParse(props.src) ? `/${props.src}` : props.src;
2933
// https://github.com/unjs/ipx?tab=readme-ov-file#modifiers

0 commit comments

Comments
 (0)