dcloudio / dcloudio/uni-app

uni cli工程创建的项目,static 目录的条件编译 无效,Hbuilderx创建的则有效

Open
#4,181 18 comments 0 reactions 1 assignee Claimed by @zhenyuWang View on GitHub
Dominant language
JavaScript
Stars
41.6k
Forks
3.7k
Avg merge
7h 6m
Merged PRs (30d)
6

Description

**问题描述**
通过 **uni cli** 创建的模板项目,在以h5或者mp-weixin打包后,代码static目录下仍然还有条件编译预定要排除的目录
而通过huilderx创建的项目,打包或者运行都能static目录条件编译

**复现步骤**
[复现问题的步骤]
1. 按照 官网指导创建uni cli项目 模板hello-uniapp
2. 在src目录的static下创建 app-plus, h5 , mp-weixin等文件夹 ,分别放入几张图片
3. 执行npm run build:h5,打包成功后进入dist/build/h5下 的static,除了h5文件夹,仍然还有app-plus和mp-weixin文件夹,
npm run build:mp-weixin也同样的情况,app-plus和h5文件目录没有被编译掉

**预期结果**
https://uniapp.dcloud.net.cn/tutorial/platform.html#static-%E7%9B%AE%E5%BD%95%E7%9A%84%E6%9D%A1%E4%BB%B6%E7%BC%96%E8%AF%91
按照此说明,uni cli 创建的项目应该能static条件编译

**实际结果**
![image](https://user-images.githubusercontent.com/54034530/221733494-ee83312a-a011-4d61-9e2f-ecd2436c7b81.png)
打包后的目录下没有编译掉mp-weixin和app-plus[h5项目]
![image](https://user-images.githubusercontent.com/54034530/221733779-e0113e9e-05f3-40fd-8123-72e5ed20925e.png)
打包后的目录下没有编译掉h5和app-plus[mp-weixin项目]

**系统信息:**
- 发行平台: 微信小程序、H5平台
- uni-app版本 [如使用Vue-cli创建/运行项目,则提供`npm run info`的运行结果]
![image](https://user-images.githubusercontent.com/54034530/221734103-acf475a7-27ab-40fc-9028-c26c2593f0b3.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.