NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.68k stars 4.79k forks source link

不兼容 preact >= 10.22.1 #16315

Open towry opened 3 months ago

towry commented 3 months ago

相关平台

微信小程序

小程序基础库: latest 使用框架: Preact

复现步骤

TypeError: n2.contains is not a function

是由于 preact 一个 commit 引起的,见 https://github.com/preactjs/preact/pull/4421#issuecomment-2290732103

期望结果

兼容 preact >= 10.22.1

实际结果

不兼容,报错导致页面空白

环境信息

👽 Taro v3.6.34

  Taro CLI 3.6.34 environment info:
    System:
      OS: macOS 14.5
      Shell: 3.7.1 - /nix/store/lfa5bn829h81f4iazzl2wpjw0hpylcjc-fish-3.7.1/bin/fish
    Binaries:
      Node: 18.16.0 - ~/.local/state/fnm_multishells/49968_1723702112322/bin/node
      npm: 9.5.1 - ~/.local/state/fnm_multishells/49968_1723702112322/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.34 => 3.6.34 
      @tarojs/components: 3.6.34 => 3.6.34 
      @tarojs/helper: 3.6.34 => 3.6.34 
      @tarojs/plugin-framework-react: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-alipay: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-h5: ^3.6.34 => 3.6.34 
      @tarojs/plugin-platform-jd: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-qq: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-swan: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-tt: 3.6.34 => 3.6.34 
      @tarojs/plugin-platform-weapp: 3.6.34 => 3.6.34 
      @tarojs/react: 3.6.34 => 3.6.34 
      @tarojs/router: 3.6.34 => 3.6.34 
      @tarojs/runtime: 3.6.34 => 3.6.34 
      @tarojs/shared: 3.6.34 => 3.6.34 
      @tarojs/taro: 3.6.34 => 3.6.34 
      @tarojs/taro-h5: 3.6.34 => 3.6.34 
      @tarojs/taro-loader: ^3.6.34 => 3.6.34 
      @tarojs/webpack5-runner: 3.6.34 => 3.6.34 
      babel-preset-taro: 3.6.34 => 3.6.34 
      eslint-config-taro: 3.6.34 => 3.6.34 
      react: ^18.0.0 => 18.3.1 
HappyYA commented 3 months ago

WX20240817-213533@2x 编译配置中增加如下代码,我的可以了。先把prebundle清空。

webpackChain(chain) {
    chain.resolve.plugin("tsconfig-paths").use(TsconfigPathsPlugin);
    chain.plugin("definePlugin").tap((args) => {
      const config = args[0];
      config.ENABLE_CONTAINS = true;
      return args;
    });
},