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

运行H5报错: _chunk_54FAVIWE_js__WEBPACK_IMPORTED_MODULE_3__.taro.createSelectorQuery is not a function #16886

Open
Fiestar opened this issue Nov 18, 2024 · 6 comments

Comments

@Fiestar
Copy link

Fiestar commented Nov 18, 2024

相关平台

H5

浏览器版本: Edge 131
使用框架: React

复现步骤

npm run dev:h5

期望结果

正常打开页面,没有报错信息

实际结果

报错

环境信息


  Taro CLI 3.6.11 environment info:
    System:
      OS: Windows 10 10.0.19045
    Binaries:
      Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.21 - C:\Program Files\nodejs\yarn.CMD
      npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 3.6.11 => 3.6.11
      @tarojs/components: 3.6.11 => 3.6.11
      @tarojs/helper: 3.6.11 => 3.6.11
      @tarojs/plugin-framework-react: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-alipay: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-h5: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-jd: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-qq: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-swan: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-tt: 3.6.11 => 3.6.11
      @tarojs/plugin-platform-weapp: 3.6.11 => 3.6.11
      @tarojs/react: 3.6.11 => 3.6.11
      @tarojs/runtime: 3.6.11 => 3.6.11
      @tarojs/shared: 3.6.11 => 3.6.11
      @tarojs/taro: 3.6.11 => 3.6.11
      @tarojs/taro-loader: 3.6.11 => 3.6.11
      @tarojs/webpack5-runner: 3.6.11 => 3.6.11
      babel-preset-taro: 3.6.11 => 3.6.11
      eslint-config-taro: 3.6.11 => 3.6.11
      react: ^18.0.0 => 18.3.1
      taro-ui: 3.3.0 => 3.3.0

补充信息

运行微信小程序没有问题, 编译H5也成功,但是实际页面上报错;
Snipaste_2024-11-18_18-23-51

@TheKonka
Copy link
Member

import { createSelectorQuery } from '@tarojs/taro'
先这样写看看

This was referenced Nov 23, 2024
@lvsong77
Copy link

import { createSelectorQuery } from '@tarojs/taro' 先这样写看看

我也遇到了,为什么这样写就可以了呢?

@TheKonka
Copy link
Member

import { createSelectorQuery } from '@tarojs/taro' 先这样写看看

我也遇到了,为什么这样写就可以了呢?

https://github.com/NervJS/taro/pull/16256/files#diff-099dee1d0eeda5968681e8e04975e2ad4aa7c3445534296639a1efd14826cd4dR227-R230

因为window环境分隔符的差异问题,导致没有应用上转换api的babel插件

@mxlt02
Copy link

mxlt02 commented Jan 17, 2025

import { createSelectorQuery } from '@tarojs/taro' 先这样写看看

我也遇到了,为什么这样写就可以了呢?

https://github.com/NervJS/taro/pull/16256/files#diff-099dee1d0eeda5968681e8e04975e2ad4aa7c3445534296639a1efd14826cd4dR227-R230

因为window环境分隔符的差异问题,导致没有应用上转换api的babel插件

请问现在有什么办法使用修复后的版本, nutui的elevator受到影响了 Taro.createSelectorQuery is not a function

@TheKonka
Copy link
Member

@mxlt02 建议直接向 nutui 维护人员反馈

@liesauer
Copy link

import { createSelectorQuery } from '@tarojs/taro'

React + Taro UI使用AtAccordion组件报一样的错,且这个方法并不生效

但是下面的可以,在app.ts添加

import Taro from '@tarojs/taro'
import { createSelectorQuery } from '@tarojs/taro'

Taro.createSelectorQuery = createSelectorQuery

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

5 participants