refactor(project): @vben/vite-connect is reconfigured to support synchronization

This commit is contained in:
vben
2024-07-13 21:00:31 +08:00
parent c81ac5684c
commit e441d14fa2
20 changed files with 175 additions and 126 deletions

View File

@@ -26,6 +26,7 @@
"cross-env": "^7.0.3",
"joi": "^17.13.3",
"js-yaml": "^4.1.0",
"mockjs": "^1.1.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
@@ -36,6 +37,7 @@
"@nestjs/cli": "^10.4.2",
"@nestjs/schematics": "^10.1.2",
"@types/express": "^4.17.21",
"@types/mockjs": "^1.0.10",
"@types/node": "^20.14.10",
"nodemon": "^3.1.4",
"ts-node": "^10.9.2",

View File

@@ -1,3 +1,5 @@
VITE_PORT = 5555
# spa-title
VITE_GLOB_APP_TITLE = Vben Admin Pro

View File

@@ -1,12 +1,12 @@
{
"name": "@vben/web-antd",
"version": "5.0.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "apps/vben-admin"
"directory": "apps/web-antd"
},
"license": "MIT",
"author": {

View File

@@ -1,59 +1,33 @@
import { defineConfig, loadAndConvertEnv } from '@vben/vite-config';
import {
defaultImportmapOptions,
defineConfig,
getDefaultPwaOptions,
loadAndConvertEnv,
} from '@vben/vite-config';
export default defineConfig({
application: async ({ mode }) => {
const envConfig = await loadAndConvertEnv();
return {
export default defineConfig(async () => {
const { appTitle, port, ...envConfig } = await loadAndConvertEnv();
return {
application: {
...envConfig,
importmap: false,
importmapOptions: {
// 通过 Importmap CDN 方式引入,
// 目前只有esm.sh源兼容性好一点jspm.io对于 esm 入口要求高
defaultProvider: 'esm.sh',
importmap: [
{ name: 'vue' },
{ name: 'pinia' },
{ name: 'vue-router' },
{ name: 'vue-i18n' },
{ name: 'dayjs' },
{ name: 'vue-demi' },
],
},
importmapOptions: defaultImportmapOptions,
pwa: false,
pwaOptions: {
manifest: {
description:
'Vben Admin Pro is a modern admin dashboard template based on Vue 3. ',
icons: [
{
sizes: '192x192',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-192.png',
type: 'image/png',
},
{
sizes: '512x512',
src: 'https://cdn.jsdelivr.net/npm/@vbenjs/static-source@0.1.3/source/pwa-icon-512.png',
type: 'image/png',
},
],
name: `Vben Admin Pro ${mode}`,
short_name: `Vben Admin Pro ${mode}`,
},
},
};
},
vite: {
server: {
proxy: {
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// 代理目标地址 - backend-mock 项目
target: 'http://localhost:5320/api',
ws: true,
pwaOptions: getDefaultPwaOptions(appTitle),
},
vite: {
server: {
port,
proxy: {
'/api': {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// 代理目标地址 - backend-mock 项目
target: 'http://localhost:5320/api',
ws: true,
},
},
},
},
},
};
});