This commit is contained in:
lf 2024-06-07 18:51:14 +08:00
commit 557b241882
2 changed files with 11 additions and 8 deletions

View File

@ -4,13 +4,7 @@
// Generated by vite-plugin-uni-pages
interface NavigateToOptions {
url: "/pages/coupon/index" |
"/pages/about/about" |
"/pages/activity/index" |
"/pages/coupon/order" |
"/pages/coupon/product" |
"/pages/index/index" |
"/pages/login/index";
url: "/pages/login/index";
}
interface RedirectToOptions extends NavigateToOptions {}

View File

@ -17,6 +17,15 @@ import AutoImport from 'unplugin-auto-import/vite'
import { visualizer } from 'rollup-plugin-visualizer'
import ViteRestart from 'vite-plugin-restart'
import fs from 'fs'
const pages = fs.readdirSync('./src/pages')
const target = process.argv.slice(2)
const result = pages
.filter((dir) => {
return !target.includes(dir)
})
.map((ele) => `**/${ele}`)
// https://vitejs.dev/config/
export default ({ command, mode }) => {
// console.log(mode === process.env.NODE_ENV) // true
@ -50,7 +59,7 @@ export default ({ command, mode }) => {
plugins: [
UniPages({
exclude: ['**/components/**/**.*'],
exclude: ['**/components/**/**.*', ...result],
routeBlockLang: 'json5', // 虽然设了默认值但是vue文件还是要加上 lang="json5", 这样才能很好地格式化
// homePage 通过 vue 文件的 route-block 的type="home"来设定
// pages 目录为 src/pages分包目录不能配置在pages目录下