提交 7949d468 authored 作者: 王鹏飞's avatar 王鹏飞

build: add vite-plugin-mkcert

上级 060686d7
差异被折叠。
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"deploy": "node ./deploy.js", "deploy": "node ./deploy.js",
"cert": "node ./cert.js" "cert": "node ./cert.js"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.0.4", "@element-plus/icons-vue": "^2.0.4",
...@@ -36,7 +35,7 @@ ...@@ -36,7 +35,7 @@
"@types/node": "^17.0.35", "@types/node": "^17.0.35",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/sortablejs": "^1.13.0", "@types/sortablejs": "^1.13.0",
"@vitejs/plugin-vue": "^2.3.3", "@vitejs/plugin-vue": "^3.2.0",
"@vue/eslint-config-typescript": "^10.0.0", "@vue/eslint-config-typescript": "^10.0.0",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"ali-oss": "^6.17.1", "ali-oss": "^6.17.1",
...@@ -46,8 +45,9 @@ ...@@ -46,8 +45,9 @@
"sass": "^1.52.1", "sass": "^1.52.1",
"typescript": "~4.7.2", "typescript": "~4.7.2",
"unplugin-auto-import": "^0.9.2", "unplugin-auto-import": "^0.9.2",
"vite": "^2.9.14", "vite": "^3.2.11",
"vite-plugin-checker": "^0.4.9", "vite-plugin-checker": "^0.4.9",
"vite-plugin-mkcert": "^1.17.6",
"vue-tsc": "^0.34.16" "vue-tsc": "^0.34.16"
} }
} }
import type { Router, RouteRecordRaw } from 'vue-router' import type { Router, RouteRecordRaw } from 'vue-router'
export default function ({ router }: { router: Router }) { export default function ({ router }: { router: Router }) {
const modules: Array<{ routes: Array<RouteRecordRaw> }> = Object.values(import.meta.globEager('./**/index.ts')) const modules: Array<{ routes: Array<RouteRecordRaw> }> = Object.values(
import.meta.glob('./**/index.ts', { eager: true })
)
modules.forEach(({ routes = [] }) => { modules.forEach(({ routes = [] }) => {
// 注册路由 // 注册路由
routes.forEach(route => { routes.forEach(route => {
......
...@@ -6,6 +6,7 @@ import { defineConfig } from 'vite' ...@@ -6,6 +6,7 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
// import checker from 'vite-plugin-checker' // import checker from 'vite-plugin-checker'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
import mkcert from 'vite-plugin-mkcert'
export default defineConfig(({ mode }) => ({ export default defineConfig(({ mode }) => ({
base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/center-resource/' : '/', base: mode === 'prod' ? 'https://webapp-pub.ezijing.com/website/prod/center-resource/' : '/',
...@@ -15,7 +16,8 @@ export default defineConfig(({ mode }) => ({ ...@@ -15,7 +16,8 @@ export default defineConfig(({ mode }) => ({
imports: ['vue', 'vue/macros', 'vue-router', '@vueuse/core'], imports: ['vue', 'vue/macros', 'vue-router', '@vueuse/core'],
dts: true, dts: true,
eslintrc: { enabled: true } eslintrc: { enabled: true }
}) }),
mkcert()
// checker({ vueTsc: true, eslint: { lintCommand: 'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"' } }) // checker({ vueTsc: true, eslint: { lintCommand: 'eslint "./src/**/*.{vue,js,jsx,ts,tsx}"' } })
], ],
server: { server: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论