1 Star 0 Fork 19

Mr.pan/vite-uniapp-template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
import path from 'node:path'
import { defineConfig } from 'vite'
import useUni from '@dcloudio/vite-plugin-uni'
import useEslint from 'vite-plugin-eslint'
import useUnoCSS from 'unocss/vite'
import useUniPages from '@uni-helper/vite-plugin-uni-pages'
import postcssConfig from './postcss.config.js'
import {
proxyPath,
proxyPort,
proxyURL,
requestFilePath,
requestPath,
useProxy,
} from './src/configs/devServer.js'
import { homePage } from './src/configs/index.js'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
useEslint(),
useUnoCSS(),
useUniPages({
mergePages: false,
homePage,
}),
useUni(),
],
server: {
cors: true,
host: true,
port: proxyPort,
proxy: {
...(useProxy && proxyURL
? {
[`^${proxyPath}`]: {
target: `${proxyURL}${requestPath}`,
changeOrigin: true,
rewrite: path => path.replace(new RegExp(`^${proxyPath}`), ''),
},
// 解决开发环境上传图片无法直接显示的问题
[`^${requestFilePath}`]: {
target: `${proxyURL}${requestFilePath}`,
changeOrigin: true,
rewrite: path =>
path.replace(new RegExp(`^${requestFilePath}`), ''),
},
}
: {}),
},
},
resolve: {
alias: {
'^@': path.resolve(__dirname, './src/'),
'$uni-router': path.resolve(__dirname, './src/utils/uni-router/'),
},
},
css: {
// 修复外部 postcss.config.js 不被解析的问题
postcss: postcssConfig,
},
build: {
// minify: false,
},
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/qqppbb/vite-uniapp-template.git
git@gitee.com:qqppbb/vite-uniapp-template.git
qqppbb
vite-uniapp-template
vite-uniapp-template
main

搜索帮助