Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

条件编译在页面文件中无效 #190

Open
5 of 7 tasks
gladtoeatu opened this issue Nov 26, 2024 · 1 comment
Open
5 of 7 tasks

条件编译在页面文件中无效 #190

gladtoeatu opened this issue Nov 26, 2024 · 1 comment

Comments

@gladtoeatu
Copy link

描述问题

支付宝小程序和微信小程序有不同的页面配置项

复现

pages/index/index.vue的route如下配置:
image
然后执行pnpm build mp之后,index.json里还是出现了编译条件是支付宝时才出现的属性
image

系统信息


基础环境信息:

  • os: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
  • node: 20.16.0
  • packageManager: pnpm
  • vscode: 1.95.3
  • volar: 2.1.10

基础依赖信息:

  • vue: 3.4.21
  • vite: 5.2.8
  • @dcloudio/uni-app: 3.0.0-4020920240930001

uni-helper依赖信息:


使用的包管理器

pnpm

核对

贡献

  • 我愿意提交一个 PR 修复这个问题
  • 我愿意提交一个 PR 带有失败的测试(实际上只要去做就好,谢谢!)
@bamf2077
Copy link

我也遇到了类似的条件编译问题,只不过是在配置文件中。

下方 pages.config.ts 中无论用哪一种条件注释写法,blurEffectfontSize 属性都被编译到了微信小程序端的 pages.json 文件中

import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'

export default defineUniPages({
  pages: [],
  globalStyle: {},
  tabBar: {
    // #ifndef MP
    blurEffect: 'light',
    // #endif

    // #ifdef APP || WEB
    fontSize: '12px',
    // #endif
  },
})

相关依赖版本:

@dcloudio/uni-app: 3.0.0-alpha-4030520241124001

@uni-helper/vite-plugin-uni-pages: 0.2.28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants