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

rn 不支持 config 中的 copy #13003

Open
hanzhangyu opened this issue Dec 19, 2022 · 4 comments
Open

rn 不支持 config 中的 copy #13003

hanzhangyu opened this issue Dec 19, 2022 · 4 comments
Labels
F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x

Comments

@hanzhangyu
Copy link

相关平台

React Native

复现仓库

[email protected]:hanzhangyu/taro-bug-report.git

使用框架: React

复现步骤

npm run build:rn 没有复制 app.ts
npm run build:h5 有复制 app.ts

期望结果

任何类型都识别通用配置

实际结果

仅部分类型适配 copy 配置

环境信息

👽 Taro v3.5.6


  Taro CLI 3.5.6 environment info:
    System:
      OS: macOS 12.3.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.1 - ~/.nvm/versions/node/v14.18.1/bin/node
      Yarn: 1.22.17 - ~/.nvm/versions/node/v14.18.1/bin/yarn
      npm: 8.5.3 - ~/.nvm/versions/node/v14.18.1/bin/npm
    npmPackages:
      @tarojs/cli: 3.5.6 => 3.5.6
      @tarojs/components: 3.5.6 => 3.5.6
      @tarojs/helper: 3.5.6 => 3.5.6
      @tarojs/plugin-framework-react: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-alipay: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-jd: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-qq: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-swan: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-tt: 3.5.6 => 3.5.6
      @tarojs/plugin-platform-weapp: 3.5.6 => 3.5.6
      @tarojs/react: 3.5.6 => 3.5.6
      @tarojs/rn-runner: ^3.5.10 => 3.5.10
      @tarojs/router: 3.5.6 => 3.5.6
      @tarojs/runtime: 3.5.6 => 3.5.6
      @tarojs/shared: 3.5.6 => 3.5.6
      @tarojs/taro: 3.5.6 => 3.5.6
      @tarojs/taro-h5: 3.5.6 => 3.5.6
      @tarojs/taro-rn: ^3.5.10 => 3.5.10
      @tarojs/webpack5-runner: 3.5.6 => 3.5.6
      babel-preset-taro: 3.5.6 => 3.5.6
      eslint-config-taro: 3.5.6 => 3.5.6
      expo: ~46.0.2 => 46.0.17
      react: ^18.0.0 => 18.2.0
      react-native: ^0.69.3 => 0.69.7

@taro-bot2 taro-bot2 bot added F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x labels Dec 19, 2022
@hanzhangyu
Copy link
Author

配置参考

  copy: {
    patterns: [
      {from: 'src/app.ts', to: 'dist/app.ts'}
    ],
    options: {
    }
  },

@yoyo837
Copy link
Contributor

yoyo837 commented Dec 19, 2022

这个本来就只支持h5的呀

@zhiqingchen
Copy link
Member

在rn里支持copy,有什么使用场景吗

@hanzhangyu
Copy link
Author

hanzhangyu commented Dec 20, 2022

@zhiqingchen 参考这个 https:/react-native-webview/react-native-webview/blob/master/docs/Guide.md#loading-local-html-files

android 使用本地 html 去实现一些特定的交互,常用的做法是,android 自行复制文件至 assets 目录

let source = Platform.OS === 'ios'
          ? require('./index.html')
          : {uri: 'file:///android_asset/index.html'};

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

No branches or pull requests

3 participants