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

使用taro-ui的searchbar案例代码编译后无法运行,开发者工具报错TypeError: Super expression must either be null or a function #13929

Open
Constantine-Marx opened this issue May 31, 2023 · 2 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@Constantine-Marx
Copy link

相关平台

微信小程序

复现仓库

https://github.com/Constantine-Marx/taroissue.git
小程序基础库: 2.32.1
使用框架: React

复现步骤

点击src/index/index.jsx
输入npm run dev:weapp
在微信开发者工具打开相应目录,并且运行
出现搜索栏但是点击无反应,onActionclick函数也没反应

期望结果

点击后有反应,右侧按钮滑出

实际结果

无反应,或直接不出现搜索栏,报错
页面【pages/index/index]错误:
TypeError: Super expression must either be null or a function
at _inherits (.node_modules@babel_runtime_helpers_esm_inherits.js:4)
at ._src_pages_index_index.jsx:3
at Object../node_modules/babel-loader/lib/index.js??ruleSet[1].rules[5].use[0]!./src/pages/index/index.jsx (._src_pages_index_index.jsx:22)
at webpack_require (webpack_bootstrap:19)
at Object../src/pages/index/index.jsx (._src_pages_index_index.jsx:22)
at webpack_require (webpack_bootstrap:19)
at webpack_exec (.node_modules@babel_runtime_helpers_esm_typeof.js:9)
at .node_modules@babel_runtime_helpers_esm_typeof.js:9
at Function.webpack_require.O (webpack_runtime_chunk loaded:25)
at .node_modules@babel_runtime_helpers_esm_typeof.js:9(env: Windows,mp,1.06.2303220; lib: 2.32.1)

环境信息

👽 Taro v3.6.7


  Taro CLI 3.6.7 environment info:
    System:
      OS: Windows 10 10.0.22000
    Binaries:
      Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.7 => 3.6.7
      @tarojs/components: 3.6.7 => 3.6.7
      @tarojs/helper: 3.6.7 => 3.6.7
      @tarojs/plugin-framework-react: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-alipay: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-h5: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-jd: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-qq: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-swan: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-tt: 3.6.7 => 3.6.7
      @tarojs/plugin-platform-weapp: 3.6.7 => 3.6.7
      @tarojs/react: 3.6.7 => 3.6.7
      @tarojs/runtime: 3.6.7 => 3.6.7
      @tarojs/shared: 3.6.7 => 3.6.7
      @tarojs/taro: 3.6.7 => 3.6.7
      @tarojs/webpack5-runner: 3.6.7 => 3.6.7
      babel-preset-taro: 3.6.7 => 3.6.7
      eslint-config-taro: 3.6.7 => 3.6.7
      react: ^18.0.0 => 18.2.0
      react-native: ^0.71.8 => 0.71.8
      taro-ui: ^3.1.0-beta.5 => 3.1.0-beta.5



补充信息

重装微信开发者工具,并且新建了一个taro项目后成功运行过一次,但后来运行其他文件时又不行了

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels May 31, 2023
@Constantine-Marx
Copy link
Author

把开发者工具重装后,重新创建了一个taro项目,然后阴差阳错可以成功,但运行了源代码后又点击不了了

@TheKonka
Copy link
Member

TheKonka commented Jun 1, 2023

我可以告诉你解决方法
1、

- extends Taro.Component 
+ extends React.Component 

2、

// config/index.js
compiler: {
  type: 'webpack5',
  prebundle: {
	enable: false,
},
}

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
Status: Todo
Development

No branches or pull requests

2 participants