1 Star 0 Fork 1

一码/vite-vue3-h5-ssr

forked from 林岑影/vite-vue3-h5-ssr 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
林岑影 提交于 2024-10-29 17:13 . chore: eslint format
import type { ConfigEnv } from 'vite'
import path from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { viteMockServe } from '@lincy/vite-plugin-mock'
import UnoCSS from 'unocss/vite'
import { defineConfig, loadEnv } from 'vite'
import Inspect from 'vite-plugin-inspect'
import Progress from 'vite-plugin-progress'
import Build from './vite.config.build'
import Components from './vite.config.components'
import Css from './vite.config.css'
import Macros from './vite.config.macros'
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }: ConfigEnv) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
const __dirname = path.dirname(fileURLToPath(import.meta.url))
console.log(`当前编译环境: ${process.env.VITE_APP_ENV}`)
return {
base: './',
server: Build.server,
build: Build.build,
css: Css,
resolve: {
alias: {
'@': path.join(__dirname, './src'),
},
},
plugins: [
...Macros(),
...Components(),
UnoCSS(),
/**
* 本地和生产模拟服务
* @see https://github.com/vbenjs/vite-plugin-mock/blob/main/README.zh_CN.md
*/
viteMockServe({
mockPath: 'mock',
enable: command === 'serve' || process.env.VITE_APP_ENV === 'test',
logger: true,
}),
/**
* 检查Vite插件的中间状态
* @see https://github.com/antfu/vite-plugin-inspect#readme
*/
Inspect(),
/**
* 打包时展示进度条的插件
* @see https://github.com/jeddygong/vite-plugin-progress/blob/main/README.zh-CN.md
*/
Progress(),
],
ssr: {
noExternal: [
'vant',
],
},
}
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/ichiva_admin/vite-vue3-h5-ssr.git
[email protected]:ichiva_admin/vite-vue3-h5-ssr.git
ichiva_admin
vite-vue3-h5-ssr
vite-vue3-h5-ssr
main

搜索帮助