You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.4 KiB
TypeScript
66 lines
1.4 KiB
TypeScript
import path from 'node:path'
|
|
import process from 'node:process'
|
|
import { setupVitePlugins } from 'build/plugins'
|
|
import type { ConfigEnv } from 'vite'
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
|
|
import generateSitemap from 'vite-ssg-sitemap'
|
|
|
|
export default defineConfig(({ command, mode }: ConfigEnv) => {
|
|
const viteEnv = loadEnv(mode, process.cwd()) as unknown as ImportMetaEnv
|
|
return {
|
|
base: viteEnv.VITE_BASE_URL,
|
|
resolve: {
|
|
alias: {
|
|
'~/': `${path.resolve(__dirname, 'src')}/`,
|
|
'#/': `${path.resolve(__dirname, 'src/types')}/`,
|
|
},
|
|
},
|
|
|
|
plugins: setupVitePlugins(viteEnv),
|
|
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 3200,
|
|
},
|
|
|
|
optimizeDeps: {
|
|
include: [],
|
|
},
|
|
|
|
// https://github.com/vitest-dev/vitest
|
|
test: {
|
|
include: ['test/**/*.test.ts'],
|
|
environment: 'jsdom',
|
|
deps: {
|
|
inline: ['@vue', '@vueuse', 'vue-demi'],
|
|
},
|
|
},
|
|
|
|
// https://github.com/antfu/vite-ssg
|
|
ssgOptions: {
|
|
script: 'async',
|
|
formatting: 'minify',
|
|
crittersOptions: {
|
|
reduceInlineStyles: false,
|
|
},
|
|
onFinished() {
|
|
generateSitemap()
|
|
},
|
|
},
|
|
|
|
ssr: {
|
|
// TODO: workaround until they support native ESM
|
|
noExternal: ['workbox-window', /vue-i18n/],
|
|
},
|
|
|
|
build: {
|
|
reportCompressedSize: false,
|
|
sourcemap: false,
|
|
commonjsOptions: {
|
|
ignoreTryCatch: false,
|
|
},
|
|
},
|
|
}
|
|
})
|