Comments (15)
Hello @gooddaddy. In order to facilitate location and troubleshooting, we need you to provide a realistic example. You can create a taro project by clicking here and provide the GitHub warehouse address and reproduce examples.
你好 @gooddaddy, 为了方便定位和排查问题,我们需要你提供一个重现实例。你可以通过点击 此处 创建一个 Taro 项目并提供 GitHub 仓库地址和重现实例。
from taro-hooks.
Hello @gooddaddy. In order to facilitate location and troubleshooting, we need you to provide a realistic example. You can create a taro project by clicking here and provide the GitHub warehouse address and reproduce examples.
你好 @gooddaddy, 为了方便定位和排查问题,我们需要你提供一个重现实例。你可以通过点击 此处 创建一个 Taro 项目并提供 GitHub 仓库地址和重现实例。
一.编译过了,但是目前类型有问题;
declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): import("./types").Result<TData, TParams> | undefined;
为啥useRequest 返回值可能是 undefined 的?这样会导致 调用useRequest后不能直接解构。
二.运行时 报错
.._src_runtime_connect.ts:275 TypeError: Object(...) is not a function
at useLatest (.node_modules@taro-hooks_ahooks_es_useLatest_index.js:4)
at useRequestImplement (.node_modules@taro-hooks_use-request_es_useRequestImplement.js:30)
at useRequest (.node_modules@taro-hooks_use-request_es_useRequest.js:12)
at ._src_pages_home_index.tsx:54
at .._src_observer.ts:104
at .._src_useObserver.ts:115
at trackDerivedFunction (.._src_core_derivation.ts:183)
at Reaction.track (.._src_core_reaction.ts:137)
at useObserver (.._src_useObserver.ts:113)
at observerComponent (.._src_observer.ts:104)(env: macOS,mp,1.06.2208010; lib: 2.25.1)
找到对应的源码 发现:
from taro-hooks.
Hello @gooddaddy. In order to facilitate location and troubleshooting, we need you to provide a realistic example. You can create a taro project by clicking here and provide the GitHub warehouse address and reproduce examples.
你好 @gooddaddy, 为了方便定位和排查问题,我们需要你提供一个重现实例。你可以通过点击 此处 创建一个 Taro 项目并提供 GitHub 仓库地址和重现实例。一.编译过了,但是目前类型有问题; declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): import("./types").Result<TData, TParams> | undefined;
为啥useRequest 返回值可能是 undefined 的?这样会导致 调用useRequest后不能直接解构。
二.运行时 报错
.._src_runtime_connect.ts:275 TypeError: Object(...) is not a function at useLatest (.node_modules@taro-hooks_ahooks_es_useLatest_index.js:4) at useRequestImplement (.node_modules@taro-hooks_use-request_es_useRequestImplement.js:30) at useRequest (.node_modules@taro-hooks_use-request_es_useRequest.js:12) at ._src_pages_home_index.tsx:54 at .._src_observer.ts:104 at .._src_useObserver.ts:115 at trackDerivedFunction (.._src_core_derivation.ts:183) at Reaction.track (.._src_core_reaction.ts:137) at useObserver (.._src_useObserver.ts:113) at observerComponent (.._src_observer.ts:104)(env: macOS,mp,1.06.2208010; lib: 2.25.1) 找到对应的源码 发现:
- 若请求发生失败或者出错的过程。data可能是为空的. 并且初始是data也是undefined
- 运行时报错可以参考一下框架配置。看下是不是有配置没有引入。配置
from taro-hooks.
若请求发生失败或者出错的过程。data可能是为空的. 并且初始是data也是undefined
data 为空正常,但是 你这里是 函数 返回都是是空,ahooks 里面的 useRequest 返回类型都不是这样的,你是不是写错了?
from taro-hooks.
若请求发生失败或者出错的过程。data可能是为空的. 并且初始是data也是undefined
data 为空正常,但是 你这里是 函数 返回都是是空,ahooks 里面的 useRequest 返回类型都不是这样的,你是不是写错了?
是一样的 Tdata
from taro-hooks.
若请求发生失败或者出错的过程。data可能是为空的. 并且初始是data也是undefined
data 为空正常,但是 你这里是 函数 返回都是是空,ahooks 里面的 useRequest 返回类型都不是这样的,你是不是写错了?是一样的 Tdata
这是 ahooks的类型声明:
import type { Options, Plugin, Service } from './types';
declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): import("./types").Result<TData, TParams>;
export default useRequest;
这是你的声明:
import type { Options, Plugin, Service } from './types';
declare function useRequest<TData, TParams extends any[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Plugin<TData, TParams>[]): import("./types").Result<TData, TParams> | undefined;
export default useRequest;
你的在后面 | undefined
from taro-hooks.
额。可能是编译的锅。这个我得看看
from taro-hooks.
额。可能是编译的锅。这个我得看看
帮忙看看,另外一个问题,我用taro cli 创建一个最新的工程,然后按照你的方式配置,工程能编译通过,但是运行报错(目前最新的taro 是3.5.5 工程默认是 webpack5的,你的插件是不是 不支持webpack5?)
from taro-hooks.
额。可能是编译的锅。这个我得看看
帮忙看看,另外一个问题,我用taro cli 创建一个最新的工程,然后按照你的方式配置,工程能编译通过,但是运行报错(目前最新的taro 是3.5.5 工程默认是 webpack5的,你的插件是不是 不支持webpack5?)
空的项目么?
from taro-hooks.
额。可能是编译的锅。这个我得看看
帮忙看看,另外一个问题,我用taro cli 创建一个最新的工程,然后按照你的方式配置,工程能编译通过,但是运行报错(目前最新的taro 是3.5.5 工程默认是 webpack5的,你的插件是不是 不支持webpack5?)
空的项目么?
工程向导中选择:react 、typescript 、webpack5 创建工程
from taro-hooks.
node 版本可以提供一下么
from taro-hooks.
node 版本可以提供一下么
node 8.5.0
package.json
{
"name": "myApp",
"version": "1.0.0",
"private": true,
"description": "",
"templateInfo": {
"name": "default",
"typescript": true,
"css": "sass"
},
"scripts": {
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:qq": "taro build --type qq",
"build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp",
"dev:weapp": "npm run build:weapp -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch"
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"author": "",
"dependencies": {
"@babel/runtime": "^7.7.7",
"@tarojs/components": "3.5.5",
"@tarojs/helper": "3.5.5",
"@tarojs/mini-runner": "^3.5.5",
"@tarojs/plugin-framework-react": "3.5.5",
"@tarojs/plugin-platform-alipay": "3.5.5",
"@tarojs/plugin-platform-jd": "3.5.5",
"@tarojs/plugin-platform-qq": "3.5.5",
"@tarojs/plugin-platform-swan": "3.5.5",
"@tarojs/plugin-platform-tt": "3.5.5",
"@tarojs/plugin-platform-weapp": "3.5.5",
"@tarojs/react": "3.5.5",
"@tarojs/router": "3.5.5",
"@tarojs/runtime": "3.5.5",
"@tarojs/shared": "3.5.5",
"@tarojs/taro": "3.5.5",
"@tarojs/taro-h5": "3.5.5",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"taro-hooks": "^2.0.0-beta-serro.3"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@taro-hooks/plugin-react": "^2.0.0-beta-serro.3",
"@tarojs/cli": "3.5.5",
"@tarojs/webpack5-runner": "3.5.5",
"@types/react": "^18.0.0",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-preset-taro": "3.5.5",
"eslint": "^8.12.0",
"eslint-config-taro": "3.5.5",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^4.2.0",
"react-refresh": "^0.11.0",
"stylelint": "^14.4.0",
"typescript": "^4.1.0",
"webpack": "5.69.0"
}
}
from taro-hooks.
暂时定位到的问题是:
- webpack5 模式下会开启预编译. 导致runtime失效. 需要关闭预编译
compiler: {
type: 'webpack5',
// 依赖预编译配置
prebundle: {
enable: false
}
},
-
3.5 开始貌似不再开发process变量了. 但是shared会依赖这个. (这个有待解决)
-
模板忘记加
babel-plugin-import
这个依赖了。
模板的问题后面会一起解决. 包的问题需要再看下解决方案. 如果着急可以用 3.5 以下的版本
from taro-hooks.
记录一下相关issue
from taro-hooks.
process 的 问题可以通过安装最新版来解决, taro-hooks-v2.0.0-beta-serro.5
官方模板这边快尽快更新.
以上. 若有问题再重新open
from taro-hooks.
Related Issues (20)
- bug:useRequest 设置 cachekey 以后列表数据残留 HOT 3
- taro-cli创建项目时选择taro-hooks@canary模板,在微信开发者工具控制台报错,渲染失败 HOT 7
- 现有taro项目中引入taro-hooks,在微信小程序开发者工具中报错 HOT 7
- bug: useRequest 未触底 连续执行loadmore HOT 3
- bug: plugin 中使用 @taro-hooks/shared 导致报错 HOT 4
- bug: 2.0版本useRequest类型定义有问题 HOT 3
- 安装taro-hooks后 ts报错“View”不能用作 JSX 组件。 HOT 3
- 官网taro init 的taro hooks模板项目启动报错。 HOT 20
- feat: preact支持 HOT 7
- bug: taro-hooks 的依赖是否遗漏了@taro-hooks/core HOT 5
- bug: error Unable to resolve module @taro-hooks/core from /Users/orrin/Workspaces/项目/sass_crm_rn/node_modules/taro-hooks/lib/useRouter/index.js: @taro-hooks/core could not be found within the project or in these directories: HOT 1
- bug: 微信小程序无法运行 HOT 3
- feat: 支持unplugin-auto-import HOT 5
- bug: 在app.ts里面使用时会报错 HOT 2
- bug: No matching export in "node_modules/@tarojs/taro-h5/dist/index.js" for import "requestSubscribeDeviceMessage" HOT 3
- bug: Cannot find module '@taro-hooks/core' HOT 3
- 为什么next-version-taro-hooks.vercel.app 这个网址最近都无法访问,只能通过vpn访问 HOT 4
- bug: taro-hooks2.0 不支持rn HOT 19
- 使用痛点 建议添加或修改 HOT 5
- bug: AutoImport 引入,在vscode里面看不到函数的方法 HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taro-hooks.