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

taro next3.0.2和微信小程序页面级别的混写,原生页面wxml重复打包 #7172

Closed
cyq333 opened this issue Jul 27, 2020 · 1 comment · Fixed by #7359
Closed
Assignees
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Milestone

Comments

@cyq333
Copy link

cyq333 commented Jul 27, 2020

相关平台

微信小程序

复现仓库

https://github.com/cyq333/taro-3.0.2-demo
小程序基础库: 2.9.4
使用框架: React

复现步骤

taro next3.0.2和原生微信小程序页面级别的混写,打包后,dist下原生页面的wxml文件并没有使用template的形式,还是保留了打包前src下的原有代码,但是确在.json中引用了base.wxml中的内容,导致重复打包,在原有微信小程序项目很庞大的时候,使用混写,base.wxml直接达到了1.2MB,但事实上打包后dist下原生微信小程序页面并没有使用到base.wxml,而是直接使用的打包前的代码,导致主包过大,无法预览(使用production后主包也超过2MB了)

原生页面src/pages/index/wxIndex.wxml

<view>wxIndex</view>

打包后dist/pages/index/wxIndex.wxml内容同上,并没有使用base.wxml的内容,但是确在dist/pages/index/wxIndex.json中引用了

{"usingComponents":{"comp":"../../comp"}}

期望结果

在混写的时候base.wxml能不包含原生页面的内容,或者打包后的原生页面wxml文件也能使用template的形式,不造成原生页面的重复打包情况

实际结果

base.wxml过大,而且并没有使用到,导致重复打包,主包过大

环境信息

Taro v3.0.5


  Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.13.1 - /usr/local/bin/node
      Yarn: 1.19.1 - /usr/local/bin/yarn
      npm: 6.12.1 - /usr/local/bin/npm
    npmPackages:
      @tarojs/components: 3.0.2 => 3.0.2
      @tarojs/mini-runner: 3.0.2 => 3.0.2
      @tarojs/react: 3.0.2 => 3.0.2
      @tarojs/runtime: 3.0.2 => 3.0.2
      @tarojs/taro: 3.0.2 => 3.0.2
      @tarojs/webpack-runner: 3.0.2 => 3.0.2
      babel-preset-taro: 3.0.2 => 3.0.2
      eslint-config-taro: 3.0.2 => 3.0.2
      react: ^16.10.0 => 16.13.1
    npmGlobalPackages:
      typescript: 3.6.3
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 27, 2020
@Chen-jj Chen-jj added the P-1 High, patch label Jul 28, 2020
@taro-bot2 taro-bot2 bot added this to the 3.0.6 milestone Jul 28, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.6, 3.0.7 Jul 29, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.7, 3.0.8 Aug 3, 2020
@luckyadam luckyadam self-assigned this Aug 11, 2020
@luckyadam
Copy link
Member

3.0.8 修复

@Chen-jj Chen-jj linked a pull request Aug 19, 2020 that will close this issue
20 tasks
Chen-jj added a commit that referenced this issue Aug 19, 2020
* fix(router): 修复配置 customRoutes 后路由跳转问题,close #7008

* fix(router): 修复 h5 对 onReachBottom 的支持

* feat(mini-runner): 支持小程序全局注册组件,close #7098

* fix(mini-runner): 去除与原生小程序混写时生成冗余代码,close #7172

* fix(helper): babel-register解析忽略项目 babelrc 配置文件,close #6821

* fix(taro): 修复 getComputedStyle 报错问题,close #7185

* fix(runtime): 修复使用 taro 代码开发自定义 tabbar 报错

* fix(webpack-runner): 修复使用 nerv 框架时组件样式设置不上的问题,close #7310

Co-authored-by: chenjiajian <798095202@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React P-1 High, patch T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants