-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
66 lines (64 loc) · 1.72 KB
/
vite.config.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import react from '@vitejs/plugin-react-swc'
import { rssPlugin } from 'vite-plugin-rss'
import { defineConfig } from 'vite'
import { resolve } from 'node:path'
// @ts-ignore - it's a commonjs module, but it's fine
import rawPosts from './src/shared/assets/data/posts.js'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
rssPlugin({
mode: 'define',
channel: {
title: 'datsfilipe.dev',
link: 'https://datsfilipe.dev/rss.xml',
description: 'RSS feed for datsfilipe.dev'
},
items: (
rawPosts as {
slug: string
title: string
summary: string
publishedAt: string
content?: string
}[]
).map(post => ({
title: post.title,
description: post.summary,
link: `https://datsfilipe.dev/posts/${post.slug}/`,
content: `<![CDATA[ ${decodeURIComponent(escape(atob(post?.content ?? '')))} ]]>`,
...(post.publishedAt && { pubDate: new Date(post.publishedAt) })
}))
})
],
assetsInclude: [resolve(__dirname, 'src/shared/assets/data/*.json')],
resolve: {
alias: {
'@app': resolve(__dirname, 'src/app'),
'@processes': resolve(__dirname, 'src/processes'),
'@pages': resolve(__dirname, 'src/pages'),
'@widgets': resolve(__dirname, 'src/widgets'),
'@features': resolve(__dirname, 'src/features'),
'@entities': resolve(__dirname, 'src/entities'),
'@shared': resolve(__dirname, 'src/shared')
}
},
build: {
outDir: 'dist',
sourcemap: true,
chunkSizeWarningLimit: 1300,
rollupOptions: {
output: {
manualChunks: {
notes: ['@shared/assets/data/notes.js'],
posts: ['@shared/assets/data/posts.js'],
routes: ['@app/lib/routes.tsx']
}
}
},
commonjsOptions: {
transformMixedEsModules: true
}
}
})