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

pxtransform 拿不到 config中的值 #17156

Open
jianjun6668 opened this issue Jan 7, 2025 · 1 comment
Open

pxtransform 拿不到 config中的值 #17156

jianjun6668 opened this issue Jan 7, 2025 · 1 comment

Comments

@jianjun6668
Copy link

相关平台

H5

浏览器版本: Chrome/131.0.0.0
使用框架: React

复现步骤

我现在在将1.3.9升级到4.0.8,升级过程中报错 ”vendors-node_modules_taro_h5_prebundle_chunk-DZCD4O6R_js.js:18426 Uncaught (in promise) TypeError: Cannot use 'in' operator to search for 'undefined' in undefined
at pxTransform (vendors-node_modules_taro_h5_prebundle_chunk-DZCD4O6R_js.js:18426:23)
at eval (webpack-internal:///./src/components/tempItem/index.js:268:70)
at ./src/components/tempItem/index.js (src_app_boot_js.js:2097:1)
at options.factory (runtime.js:966:31)
at webpack_require (runtime.js:34:32)
at fn (runtime.js:624:21)
at eval (webpack-internal:///./src/pages/home/index.js:38:85)
at ./src/pages/home/index.js (src_app_boot_js.js:2174:1)
at options.factory (runtime.js:966:31)
at webpack_require (runtime.js:34:32)“,查看代码发现没有读到config中的值。

然后我新建一个项目,在useLaunch中使用Taro.pxTransform(10)同样报错,报错信息如下
”Uncaught TypeError: Cannot read properties of undefined (reading 'pxTransform')
at eval (app.js:10:1)
eval @ app.js:10
setTimeout
eval @ app.js:9
callback @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:90
(匿名) @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:480
triggerAppHook @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:480
onLaunch @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:409
(匿名) @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:292
Promise.then
waitAppWrapper @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:292
value @ vendors-node_modules_taro_h5_prebundle_chunk-YE3WZ4YS_js.chunkhash.js:411
createRouter @ vendors-node_modules_taro_h5_prebundle_chunk-YZEYTA5X_js.chunkhash.js:41276
eval @ app.boot.js:47
./src/app.boot.js @ src_app_boot_js.chunkhash.js:84
options.factory @ runtime.c77173c8.js:798
webpack_require @ runtime.c77173c8.js:34
fn @ runtime.c77173c8.js:456
Promise.then
eval @ app.config.js:1
./src/app.config.js @ app.c77173c8.js:49
options.factory @ runtime.c77173c8.js:798
webpack_require @ runtime.c77173c8.js:34
webpack_exec @ app.c77173c8.js:2004
(匿名) @ app.c77173c8.js:2005
webpackJsonpCallback @ runtime.c77173c8.js:1415
(匿名) @ app.c77173c8.js:9“

期望结果

期望可以正常使用

实际结果

报错

环境信息

Taro CLI 4.0.8 environment info:
    System:
      OS: macOS 15.1.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
      npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.8 => 4.0.8 
      @tarojs/components: 4.0.8 => 4.0.8 
      @tarojs/helper: 4.0.8 => 4.0.8 
      @tarojs/plugin-framework-react: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-alipay: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-h5: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-harmony-hybrid: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-jd: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-qq: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-swan: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-tt: 4.0.8 => 4.0.8 
      @tarojs/plugin-platform-weapp: 4.0.8 => 4.0.8 
      @tarojs/react: 4.0.8 => 4.0.8 
      @tarojs/runtime: 4.0.8 => 4.0.8 
      @tarojs/shared: 4.0.8 => 4.0.8 
      @tarojs/taro: 4.0.8 => 4.0.8 
      @tarojs/taro-h5: ^4.0.8 => 4.0.8 
      @tarojs/taro-loader: 4.0.8 => 4.0.8 
      @tarojs/webpack5-runner: 4.0.8 => 4.0.8 
      babel-preset-taro: 4.0.8 => 4.0.8 
      eslint-config-taro: 4.0.8 => 4.0.8 
      react: ^18.0.0 => 18.3.1 
      taro-ui: ^3.3.0 => 3.3.0 
@jianjun6668
Copy link
Author

看了下代码是在调用pxTransform,还没有init完。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant