generated from sky172839465/vite-spa-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
43 lines (38 loc) · 964 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
import react from '@vitejs/plugin-react'
import path from 'path'
import tailwindcss from 'tailwindcss'
import { defineConfig } from 'vite'
import mdPlugin from 'vite-plugin-markdown'
import sitemapPlugin from 'vite-plugin-sitemap'
import { homepage } from './package.json'
import pwaPluginConfig from './pwa.config'
import routes from './src/data/routes.json'
const routePaths = routes.map(route => route.path)
// https://vitejs.dev/config/
export default ({ mode }) => {
const isProd = mode === 'production'
return defineConfig({
plugins: [
react(),
pwaPluginConfig,
mdPlugin.plugin({ mode: 'html' }),
sitemapPlugin({
hostname: homepage,
dynamicRoutes: routePaths
})
],
css: {
postcss: {
plugins: [tailwindcss()]
}
},
define: {
'window.IS_PROD': `${isProd}`
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src')
}
}
})
}