-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
53 lines (47 loc) · 1.32 KB
/
astro.config.mjs
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
// 导入依赖库
import { defineConfig } from 'astro/config'
import { fileURLToPath, URL } from 'node:url'
import tailwind from '@astrojs/tailwind'
import custConfig from './config/config'
// 导入预启动项目脚本
import prebuild from './scripts/prebuild.mjs'
prebuild()
// https://astro.build/config
export default defineConfig({
// 整体配置项目
site: custConfig.site.url,
base: custConfig.site.base,
integrations: [tailwind()],
// 开发配置
server: {
port: 14724,
host: true,
},
devToolbar: {
enabled: false,
},
// 生产配置
build: {
assetsPrefix: custConfig.site.cdn,
},
vite: {
// 修改资源输出路径
build: {
rollupOptions: {
output: {
hashCharacters: 'hex',
assetFileNames: 'ch_assets/[name].[hash].[ext]',
entryFileNames: 'ch_assets/[name].[hash].js',
chunkFileNames: 'ch_assets/[name].[hash].js',
},
},
},
// 引入@作为./src的alias
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'~': fileURLToPath(new URL('./config', import.meta.url)),
},
},
},
})