kit icon indicating copy to clipboard operation
kit copied to clipboard

option to skip enhanced img in development

Open nstringham opened this issue 1 year ago • 1 comments

Describe the problem

We have some large unoptimized images that we use @sveltejs/enhanced-img but it makes npm run dev very slow at first.

Describe the proposed solution

Make an option to disable the image compression in dev mode and just use the original image unmodified but then build the optimised versions in production.

maybe something like this

export default defineConfig(({ mode }) => ({
	plugins: [
		enhancedImages({
			optimiseImages: mode == "production"
		}),
		sveltekit()
	]
}));

Alternatives considered

We considered using smaller images but wanted to make it easy for less experienced developers to add images to our website.

Importance

would make my life easier

Additional Information

No response

nstringham avatar Jul 07 '24 00:07 nstringham

I was incorrect, it isn't actually slow every time we do npm run dev, only the first time after we do npm ci. This decrease the importance to nice to have for us.

Another potential solution would be if some message could be displayed while the instead are being optimized instead of just hanging. I'm concerned that new developers will be confused by the radio silence and things that something crashed.

nstringham avatar Jul 08 '24 10:07 nstringham

Closing this as a duplicate of https://github.com/sveltejs/kit/issues/12842

teemingc avatar Oct 28 '24 11:10 teemingc