Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>mall-app-preprocess-supportNew to Visual Studio Code? Get it now.
mall-app-preprocess-support

mall-app-preprocess-support

sundial-dreams

|
32 installs
| (0) | Free
条件编译语法支持
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

条件编译语法支持

说明

支持条件编译高亮 、条件编译合法性校验 、条件编译代码补全提示 、条件编译区块折叠等能力。 example.jpg example.jpg

条件编译指令一览

条件编译解析库:https://github.com/jsoverson/preprocess

  • if
  • else
  • endif
  • ifdef
  • ifndef
  • include (不推荐使用)
  • include-static (不推荐使用)
  • extend (不推荐使用)
  • endextend (不推荐使用)
  • extendable (不推荐使用)
  • exclude (不推荐使用)
  • endexclude (不推荐使用)
  • echo (不推荐使用)
  • foreach (不推荐使用)
  • endfor(不推荐使用)
  • exec (不推荐使用)

注入的变量

  1. 构建阶段手动注入变量:

    • p 渠道变量,例如@if p === 'wx'
    • wx 小程序渠道,例如@ifdef wx
    • app app渠道,例如@ifdef app
    • mt 美团app渠道,例如@ifdef mt
    • wxmt 美团小程序渠道,例如@ifdef wxmt
  2. process.env中的变量:即本地/流水线构建时增加的环境变量,如CI、APP_DEBUG、APP_NAME、NODE_ENV等,均可用于条件编译判断,例如@ifdef CI或@if NODE_ENV === 'production'

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft