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

组件多级嵌套后子组件的usingComponents内容不会打包到dist目录 #11755

Closed
DreamSeeker321 opened this issue May 4, 2022 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@DreamSeeker321
Copy link

相关平台

微信小程序

小程序基础库: 2.12.0
使用框架: React

复现步骤

// page.tsx

import CarKind from '@/hocs/CarKind'
class Page extends Component<{}, State> {
  constructor(props) {
    super(props)
  }
 render() {
    return (
      <View className='kind'>
        <CarKind />
      </View>
    )
  }
}
export default Page

// page.config.ts

export default {}

// CarKind.tsx 组件中引入微信原生小程序组件

class CarKind extends Component<{}, State> {
  constructor(props) {
    super(props)
  }
  render() {
    return (
      <View>
        <native-component></native-component>
      </View>
    )
   }
}
export default CarKind

// CarKind.config.ts

export default {
  usingComponents: {
    'native-component': '../native/component',
  }
}

期望结果

打包生成的结果中有组件的usingComponents包含的原生组件

实际结果

打包生成的结果缺少组件的usingComponents包含的原生组件

环境信息

👽 Taro v1.3.18


  Taro CLI 1.3.18 environment info:
    System:
      OS: macOS 12.3.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.19.1 - ~/.nvm/versions/node/v14.19.1/bin/node
      Yarn: 1.22.18 - ~/.nvm/versions/node/v14.19.1/bin/yarn
      npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm
    npmPackages:
      @tarojs/async-await: 1.3.18 => 1.3.18 
      @tarojs/cli: ^3.4.8 => 3.4.8 
      @tarojs/components: 3.4.7 => 3.4.7 
      @tarojs/components-qa: 1.3.18 => 1.3.18 
      @tarojs/plugin-csso: 1.3.18 => 1.3.18 
      @tarojs/plugin-sass: 1.3.18 => 1.3.18 
      @tarojs/plugin-uglifyjs: 1.3.18 => 1.3.18 
      @tarojs/taro: 3.4.7 => 3.4.7 
      @tarojs/webpack-runner: 3.4.7 => 3.4.7 
      eslint-config-taro: 3.4.7 => 3.4.7 
      nerv-devtools: ^1.5.5 => 1.5.7 
      nervjs: ^1.5.5 => 1.5.7 
      react: ^17.0.0 => 17.0.2 

补充信息

使用的是taro的最新版本3.4.8。

附上解决办法:在页面的config.ts这把组件中引用的原生组件写进来加就行了。

// page.config.ts

export default {
 usingComponents: {
    'native-component': '../native/component',
  }
}
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels May 4, 2022
@Chen-jj
Copy link
Contributor

Chen-jj commented May 6, 2022

Taro3 的组件没有配置文件了,配置需要写在页面的配置文件里。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants