-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.js
47 lines (41 loc) · 926 Bytes
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { sveltekit } from '@sveltejs/kit/vite';
import { imagetools } from 'vite-imagetools';
import path from 'path';
const supportedExtensions = ['png', 'jpg', 'jpeg'];
const config = {
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,
//source: true,
width: '200;320;480;720;1028;1400;1920'
});
}
return new URLSearchParams();
}
}),
sveltekit()],
css: {
preprocessorOptions: {
scss: {
additionalData: '@use "src/variables.scss" as *;'
}
}
},
resolve: {
alias: {
$data: path.resolve('./data')
}
},
server: {
fs: {
// Allow serving files from one level up to the project root
allow: ['..']
}
}
};
export default config;