feat: demo 全部展示,不需要变量控制
This commit is contained in:
parent
0943ddcbe0
commit
e7262dc1db
5
env/.env
vendored
5
env/.env
vendored
@ -4,8 +4,3 @@ VITE_APP_PORT = 9000
|
|||||||
# TODO: 记得修改
|
# TODO: 记得修改
|
||||||
VITE_UNI_APPID = 'H5871D791'
|
VITE_UNI_APPID = 'H5871D791'
|
||||||
VITE_WX_APPID = 'wxa2abb91f64032a2b'
|
VITE_WX_APPID = 'wxa2abb91f64032a2b'
|
||||||
|
|
||||||
# 生产环境小程序要过滤掉demo,因为demo里面很多本地图片,超过2M的主包大小
|
|
||||||
# 是否显示DEMO,1-显示,0-不显示
|
|
||||||
# TIPS:可以通过新增 .env.local 改写
|
|
||||||
VITE_SHOW_DEMO=0
|
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
|
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
|
||||||
import path from 'node:path'
|
|
||||||
import { loadEnv } from 'vite'
|
|
||||||
|
|
||||||
// 获取环境变量的范例
|
|
||||||
const env = loadEnv(process.env.NODE_ENV!, path.resolve(process.cwd(), 'env'))
|
|
||||||
// console.log(env)
|
|
||||||
const { VITE_SHOW_DEMO } = env
|
|
||||||
|
|
||||||
export default defineUniPages({
|
export default defineUniPages({
|
||||||
globalStyle: {
|
globalStyle: {
|
||||||
@ -31,37 +24,19 @@ export default defineUniPages({
|
|||||||
fontSize: '10px',
|
fontSize: '10px',
|
||||||
iconWidth: '24px',
|
iconWidth: '24px',
|
||||||
spacing: '3px',
|
spacing: '3px',
|
||||||
list:
|
list: [
|
||||||
VITE_SHOW_DEMO === '1'
|
|
||||||
? [
|
|
||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/home.png',
|
iconPath: 'static/tabbar/home.png',
|
||||||
selectedIconPath: 'static/tabbar/homeHL.png',
|
selectedIconPath: 'static/tabbar/homeHL.png',
|
||||||
pagePath: 'pages/index/index',
|
pagePath: 'pages/index/index',
|
||||||
text: '首页',
|
text: '首页',
|
||||||
},
|
},
|
||||||
// 生产环境要注释掉demo,所以分开来写
|
|
||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/example.png',
|
iconPath: 'static/tabbar/example.png',
|
||||||
selectedIconPath: 'static/tabbar/exampleHL.png',
|
selectedIconPath: 'static/tabbar/exampleHL.png',
|
||||||
pagePath: 'pages/demo/index',
|
pagePath: 'pages/demo/index',
|
||||||
text: '示例',
|
text: '示例',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
iconPath: 'static/tabbar/personal.png',
|
|
||||||
selectedIconPath: 'static/tabbar/personalHL.png',
|
|
||||||
pagePath: 'pages/my/index',
|
|
||||||
text: '我的',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
iconPath: 'static/tabbar/home.png',
|
|
||||||
selectedIconPath: 'static/tabbar/homeHL.png',
|
|
||||||
pagePath: 'pages/index/index',
|
|
||||||
text: '首页',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/personal.png',
|
iconPath: 'static/tabbar/personal.png',
|
||||||
selectedIconPath: 'static/tabbar/personalHL.png',
|
selectedIconPath: 'static/tabbar/personalHL.png',
|
||||||
|
@ -49,10 +49,7 @@ export default ({ command, mode }) => {
|
|||||||
envDir: './env', // 自定义env目录
|
envDir: './env', // 自定义env目录
|
||||||
plugins: [
|
plugins: [
|
||||||
UniPages({
|
UniPages({
|
||||||
exclude:
|
exclude: ['**/components/**/**.*'],
|
||||||
env.VITE_SHOW_DEMO === '1'
|
|
||||||
? ['**/components/**/**.*']
|
|
||||||
: ['**/components/**/**.*', '**/demo/**/**.*'],
|
|
||||||
homePage: 'pages/index/index',
|
homePage: 'pages/index/index',
|
||||||
subPackages: ['src/pages-sub'],
|
subPackages: ['src/pages-sub'],
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user