1 Star 0 Fork 0

Zack / gm-front

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vite.config.js 3.47 KB
一键复制 编辑 原始数据 按行查看 历史
000883 提交于 2023-11-29 20:06 . update:修改打包命令
import { fileURLToPath, URL } from 'node:url'
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd())
const { VITE_BASE_PATH } = env
return {
base: VITE_BASE_PATH,
plugins: [
vue(),
vueJsx(),
createSvgIconsPlugin({
// 指定要缓存的文件夹
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons/svg')],
// 指定symbolId格式
symbolId: 'icon-[dir]-[name]',
}),
nodePolyfills({
// Whether to polyfill `node:` protocol imports.
protocolImports: true,
}),
],
server: {
// 本地服务器主机名 配置后可以使用本地网络访问
host: true,
// 指定启动端口号
port: 3002,
// 设为 true 时若端口已被占用则会直接退出,而不是尝试下一个可用端口
strictPort: false,
// 服务器启动时自动在浏览器中打开应用程序,当此值为字符串时,会被用作 URL 的路径名
open: true,
proxy: {
'/api': {
target: 'https://dev-api.gpumall.com/api/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/docs': {
target: 'https://gpumall.com.cn/docs/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/docs/, ''),
}
},
},
resolve: {
// 别名
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'comps': fileURLToPath(new URL('src/components', import.meta.url)),
'views': fileURLToPath(new URL('src/views', import.meta.url)),
'stores': fileURLToPath(new URL('src/stores', import.meta.url)),
'utils': fileURLToPath(new URL('src/utils', import.meta.url)),
'libs': fileURLToPath(new URL('src/libs', import.meta.url)),
'api': fileURLToPath(new URL('src/api', import.meta.url)),
'styles': fileURLToPath(new URL('src/styles', import.meta.url))
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import \'@/assets/styles/abstracts/_variables.scss\';'
},
less: {
modifyVars: {
// 在这里添加你想要修改的 Ant Design Vue 主题变量
// 例如,修改主色为蓝色
'@primary-color': "#0077FF",
'@success-color': '#80b178',
'@warning-color': '#d8c49a',
'@error-color': '#d1786b',
'@heading-color': '#333333',
'@text-color': '#666666',
'@text-color-secondary': '#999999'
},
javascriptEnabled: true
}
}
}
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zjc348/gm-front.git
git@gitee.com:zjc348/gm-front.git
zjc348
gm-front
gm-front
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891