Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat: 更新vite版本
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmao88 committed Dec 26, 2023
1 parent 3745c84 commit 7a375c3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 21 deletions.
3 changes: 2 additions & 1 deletion apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "apps/ant-app"
},
"type": "module",
"author": {
"name": "vben",
"email": "[email protected]",
Expand Down Expand Up @@ -63,7 +64,7 @@
"@vue/test-utils": "^2.4.1",
"naive-ui": "^2.35.0",
"typescript": "^5.2.2",
"vite": "4.5.0",
"vite": "5.0.10",
"vue-tsc": "^1.8.20"
}
}
2 changes: 1 addition & 1 deletion apps/admin/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@config/css-preprocess/postcss')
export * from '@config/css-preprocess/postcss.js'
10 changes: 6 additions & 4 deletions apps/admin/src/router/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { loadRoutesFromModules } from '@vben/utils';
import { RouteRecordRaw } from 'vue-router';
import { loadRoutesFromModules } from '@vben/utils'
import { RouteRecordRaw } from 'vue-router'

const routeModuleRecord = import.meta.globEager('./modules/**/*.ts') as any
const routeModules: RouteRecordRaw[] = loadRoutesFromModules(routeModuleRecord);
const routeModuleRecord = import.meta.glob('./modules/**/*.ts', {
eager: true,
}) as any
const routeModules: RouteRecordRaw[] = loadRoutesFromModules(routeModuleRecord)

export const asyncRoutes = [...routeModules]
3 changes: 2 additions & 1 deletion apps/gf-vben/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"server:gzip": "pnpx http-server dist --cors --gzip -c-1",
"type:check": "vue-tsc --noEmit --skipLibCheck"
},
"type": "module",
"dependencies": {
"@ant-design/icons-vue": "^7.0.1",
"@config/vite": "workspace:*",
Expand Down Expand Up @@ -63,7 +64,7 @@
"@vue/test-utils": "^2.4.1",
"naive-ui": "^2.35.0",
"typescript": "^5.2.2",
"vite": "4.5.0",
"vite": "5.0.10",
"vue-tsc": "^1.8.20"
}
}
2 changes: 1 addition & 1 deletion apps/gf-vben/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@config/css-preprocess/postcss')
export * from '@config/css-preprocess/postcss.js'
10 changes: 6 additions & 4 deletions apps/gf-vben/src/router/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { loadRoutesFromModules } from '@vben/utils';
import { RouteRecordRaw } from 'vue-router';
import { loadRoutesFromModules } from '@vben/utils'
import { RouteRecordRaw } from 'vue-router'

const routeModuleRecord = import.meta.globEager('./modules/**/*.ts') as any
const routeModules: RouteRecordRaw[] = loadRoutesFromModules(routeModuleRecord);
const routeModuleRecord = import.meta.glob('./modules/**/*.ts', {
eager: true,
}) as any
const routeModules: RouteRecordRaw[] = loadRoutesFromModules(routeModuleRecord)

export const asyncRoutes = [...routeModules]
5 changes: 3 additions & 2 deletions configs/css-preprocess/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@config/css-preprocess",
"version": "0.0.1",
"private": true,
"type": "module",
"files": [
"postcss.js",
"tailwind.js",
Expand All @@ -11,7 +12,7 @@
"clean": "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo"
},
"dependencies": {
"postcss": "^8.4.31",
"postcss-preset-env": "^9.2.0"
"postcss": "^8.4.32",
"postcss-preset-env": "^9.3.0"
}
}
2 changes: 1 addition & 1 deletion configs/css-preprocess/postcss.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
plugins: {
'postcss-preset-env': {
autoprefixer: {},
Expand Down
7 changes: 4 additions & 3 deletions configs/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "@config/vite",
"version": "0.0.2",
"private": true,
"main": "dist/index.cjs",
"main": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"clean": "pnpm rimraf node_modules && pnpm rimraf dist && pnpm rimraf .turbo",
"prepack": "pnpm unbuild --stub"
},
"type": "module",
"dependencies": {
"@vben/utils": "workspace:*",
"@vitejs/plugin-legacy": "^4.1.1",
Expand All @@ -23,8 +24,8 @@
"rollup-plugin-visualizer": "^5.9.2",
"terser": "^5.22.0",
"@config/tsconfig": "workspace:*",
"unocss": "^0.57.1",
"vite": "4.5.0",
"unocss": "^0.58.0",
"vite": "5.0.10",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
Expand Down
2 changes: 1 addition & 1 deletion configs/vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function createViteConfig(
},
server: {
hmr: true,
https: VITE_USE_HTTPS,
// https: VITE_USE_HTTPS,
port: 3000,
host: true,
proxy: !VITE_USE_HTTPS ? resolveProxy(VITE_PROXY) : undefined,
Expand Down
4 changes: 3 additions & 1 deletion packages/router/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { loadRoutesFromModules } from '@vben/utils'

export * from './basic'

const routeModuleRecord = import.meta.globEager('./modules/**/*.ts') as any
const routeModuleRecord = import.meta.glob('./modules/**/*.ts', {
eager: true,
}) as any
const routeModules: RouteRecordRaw[] = loadRoutesFromModules(routeModuleRecord)

export const layoutRoutes = [...routeModules]
Expand Down
1 change: 0 additions & 1 deletion packages/vbenComponents/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { App, Component } from 'vue'
const projectName = 'Vben3'
export const components = {
install: (app: App) => {
// const comp = import.meta.globEager('./**/*.vue')
/* 上面写法vite官方已弃用,详情见 https://cn.vitejs.dev/guide/migration-from-v2.html#importmetaglob */
const comp = import.meta.glob<any>('./**/*.vue', { eager: true })
Object.keys(comp).forEach((k) => {
Expand Down

0 comments on commit 7a375c3

Please sign in to comment.