taro 不兼容 preact >= 10.22.1

pgx2nnw8  于 3个月前  发布在  React
关注(0)|答案(1)|浏览(106)

相关平台

微信小程序

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

复现步骤

TypeError: n2.contains is not a function

是由于 preact 一个 commit 引起的,见 preactjs/preact#4421 (comment)

期望结果

兼容 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
whitzsjs

whitzsjs1#

编译配置中增加如下代码,我的可以了。先把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;
    });
},

相关问题