Skip to content

Error when converting an image #9276

Closed Answered by mischnic
ux-ui-pro asked this question in Q&A
Discussion options

You must be logged in to vote

To make Parcel pick up the images, you need to have this code (literally)

      <source type="image/avif" srcset="../image_01.jpg?as=avif&width=400, ../image_01.jpg?as=avif&width=800">

or

      new URL("../image_01.jpg?as=avif&width=400, ../image_01.jpg?as=avif&width=800", import.meta.url)

And not

      const x = "../image_01.jpg?as=avif&width=400, ../image_01.jpg?as=avif&width=800";
	  new URL(x, import.meta.url)

Otherwise Parcel can't determine statically (without running your code) at build time which images to process

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ux-ui-pro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants