sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.6k stars 1.92k forks source link

option to skip enhanced img in development #12443

Open nstringham opened 3 months ago

nstringham commented 3 months ago

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 commented 3 months ago

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.