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

通过plugin-inject插件新增组件,编译后部分基础组件丢失 #13299

Closed
molunhui opened this issue Feb 14, 2023 · 0 comments · Fixed by #13306, #13361, #14607 or #14811
Closed

通过plugin-inject插件新增组件,编译后部分基础组件丢失 #13299

molunhui opened this issue Feb 14, 2023 · 0 comments · Fixed by #13306, #13361, #14607 or #14811
Assignees
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@molunhui
Copy link

相关平台

微信小程序

复现仓库

https://github.com/molunhui/taro-plugin-inject-debug.git
小程序基础库: 2.30.0
使用框架: React

复现步骤

  1. yarn add @tarojs/plugin-inject -D 安装插件
  2. 在config/index 增加插件配置:
    ['@tarojs/plugin-inject', {
    components: {
    // 新增一个组件
    MyComponent: {
    key: "",
    transform: "true",
    duration: "300",
    "easing-function": ""
    }
    },
    // 新增的组件需要写映射
    componentsMap: {
    MyComponent: 'my-component'
    }
    }]
  3. 编译 yarn dev:weapp
  4. 在页面中引入并使用基础组件如: Input
  5. 预览,发现input组件不渲染
  6. 检查产物,发现base.wxml 模板文件没有 input 组件模板生成,包括其他诸如 textarea, slider等等,仅view, text,image这些基础组件正常

期望结果

编译后基础组件不丢失

实际结果

编辑后部分基础组件丢失

环境信息

Taro CLI 3.6.1 environment info:
    System:
      OS: macOS 13.0.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 14.21.2 - ~/.nvm/versions/node/v14.21.2/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.2/bin/yarn
      npm: 6.14.17 - ~/.nvm/versions/node/v14.21.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.1 => 3.6.1
      @tarojs/components: 3.6.1 => 3.6.1
      @tarojs/helper: 3.6.1 => 3.6.1
      @tarojs/plugin-framework-react: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-alipay: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-h5: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-jd: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-qq: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-swan: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-tt: 3.6.1 => 3.6.1
      @tarojs/plugin-platform-weapp: 3.6.1 => 3.6.1
      @tarojs/react: 3.6.1 => 3.6.1
      @tarojs/runtime: 3.6.1 => 3.6.1
      @tarojs/shared: 3.6.1 => 3.6.1
      @tarojs/taro: 3.6.1 => 3.6.1
      @tarojs/webpack5-runner: 3.6.1 => 3.6.1
      babel-preset-taro: 3.6.1 => 3.6.1
      eslint-config-taro: 3.6.1 => 3.6.1
      react: ^18.0.0 => 18.2.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Feb 14, 2023
@AdvancedCat AdvancedCat self-assigned this Feb 15, 2023
@Chen-jj Chen-jj mentioned this issue Sep 26, 2023
18 tasks
Chen-jj added a commit that referenced this issue Oct 31, 2023
…14607)

* fix(plugin-inject): 修复 Vue2 使用 componentsMap 配置时报错的问题,#13299 #14520

* fix(plugin-inject): 开启 treeshake

---------

Co-authored-by: xuanzebin <38971117+xuanzebin@users.noreply.github.com>
moseszhou added a commit to moseszhou/taro that referenced this issue Nov 1, 2023
* next:
  fix: 修复babel-plugin-transform-taroapi插件对canIUse入参scheme处理问题 (NervJS#14717)
  feat: deriveDataFromProps逻辑抽离到/plugin-platform-alipay
  fix(alipay): support root-portal component (NervJS#14171)
  fix(plugin-inject): 修复 Vue2 使用 componentsMap 配置时报错的问题,NervJS#13299 NervJS#14520 (NervJS#14607)
  fix(weapp): `Map` attribute replenishment
  refactor(types): sync components types
  fix(weapp): `LivePlayer` attribute replenishment (NervJS#14668)
  fix(tt): `Input` attribute replenishment
  types: 根据文档补充配置 enableSourceMap 类型
  fix(weapp): 完善微信小程序视频号相关组件的属性实现,fix NervJS#14608
  chore: 添加提示文案
  fix: 支付宝渲染问题, 当页面复杂,CustomWrapper和page都有数据更新时,CustomWrapper的UI有几率出现不更新的情况
  Revert "perf: rn端sass文件引入路径包含别名时支持~,例如: @import ’~@/common/baseStyle.scss‘"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment