自定义打包脚本初步就位
This commit is contained in:
parent
706da56574
commit
697c5df699
|
@ -38,52 +38,6 @@
|
|||
]
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/coupon/index",
|
||||
"type": "home",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "卡券页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/about/about",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "关于"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/activity/index",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "活动页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/coupon/order",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationBarTitleText": "订单页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/coupon/product",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationBarTitleText": "产品页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "首页"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"type": "page",
|
||||
|
|
|
@ -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 {}
|
||||
|
||||
|
|
|
@ -17,6 +17,16 @@ 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}`)
|
||||
console.log(result)
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default ({ command, mode }) => {
|
||||
// console.log(mode === process.env.NODE_ENV) // true
|
||||
|
@ -50,7 +60,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目录下
|
||||
|
|
Loading…
Reference in New Issue