imagetools icon indicating copy to clipboard operation
imagetools copied to clipboard

Allow output format directives in defaultDirectives

Open marcustyphoon opened this issue 3 years ago • 0 comments

Hello 👋

My collaborator and I are trying to use vite-imagetools to transition a project from the Gatsby ecosystem. We weren't able to use a meta format directive from within the defaultDirectives override, as the actual import's parameters are checked for output formats.

I assume allowing this would be as simple as changing srcURL.searchParams.has(key) to directives.has(key) here:

https://github.com/JonasKruckenberg/imagetools/blob/58eabc941d5270f65e353f4b3466f4d337a109eb/packages/vite/src/index.ts#L97-L106

Is there a reason this isn't permitted, or is this an oversight? Thanks for any info!

(And, before you ask, yes, I can think of ways in which our use of defaultDirectives in some cases rubs up against the spirit of some of the comments in #160, but we aren't able to make use of query parameters with dynamic import vars without hacking the rollup plugin, and I feel fine using defaultDirectives in this spot.)

marcustyphoon avatar Mar 24 '22 11:03 marcustyphoon