floter.design/vite.config.ts
2023-08-23 16:15:00 +02:00

24 lines
653 B
TypeScript

import { sveltekit } from '@sveltejs/kit/vite';
import { imagetools } from 'vite-imagetools';
import { defineConfig } from 'vite';
const supportedExtensions = ['png', 'jpg', 'jpeg'];
export default defineConfig({
plugins: [
imagetools({
defaultDirectives: (url) => {
const extension = url.pathname.substring(
url.pathname.lastIndexOf('.') + 1
);
if (supportedExtensions.includes(extension)) {
return new URLSearchParams({
format: 'avif;webp;' + extension,
// picture: true
});
}
return new URLSearchParams();
}
}),
sveltekit()]
});