-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
51 lines (49 loc) · 1.66 KB
/
vite.config.ts
File metadata and controls
51 lines (49 loc) · 1.66 KB
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
48
49
50
51
import path from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
import sitemapPlugin from 'vite-plugin-sitemap';
import { menu } from './src/components/menu';
// import { ImageSitemap } from './src/utils/seo/sitemap/image';
const __dirname = dirname(fileURLToPath(import.meta.url));
const dynamicRoutes = menu.map(name => {
if (!name.url.includes('http')) {
return name.url;
}
}).filter((route): route is string => route !== undefined);
export default {
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@assets": path.resolve(__dirname, "./src/assets"),
"@components": path.resolve(__dirname, "./src/components"),
"@pages": path.resolve(__dirname, "./src/pages"),
"@styles": path.resolve(__dirname, "./src/styles"),
"@utils": path.resolve(__dirname, "./src/utils"),
"@templates": path.resolve(__dirname, "./src/templates"),
},
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
build: {
rollupOptions: {
external: ["sharp"],
output: {
manualChunks: {}
}
},
chunkSizeWarningLimit: 1000, // Size in kB
},
plugins: [
ViteImageOptimizer({
/* pass your config */
}),
sitemapPlugin({
hostname: 'https://about.pphat.top',
dynamicRoutes
}),
// ImageSitemap({
// content: './public/**/*.{jpg,jpeg,png,gif,webp}',
// outputPath: './public/sitemap-images.xml',
// })
],
}