taro 使用不了 whatwg-url中的new URL()

xggvc2p6  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(97)

相关平台

微信小程序

小程序基础库: 3.0.2
使用框架: React

复现步骤

import { URL } from 'whatwg-url'; 之后立即报错

期望结果

运行正常

实际结果

vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:589 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf ()
at node_modules/whatwg-url/lib/utils.js (vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:589:45)
at __require2 (node_modules_taro_h5_prebundle_react-dom_js.js:33:56)
at node_modules/whatwg-url/lib/URL.js (vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:3377:21)
at __require2 (node_modules_taro_h5_prebundle_react-dom_js.js:33:56)
at node_modules/whatwg-url/webidl2js-wrapper.js (vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:3753:19)
at __require2 (node_modules_taro_h5_prebundle_react-dom_js.js:33:56)
at node_modules/whatwg-url/index.js (vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:3763:42)
at __require2 (node_modules_taro_h5_prebundle_react-dom_js.js:33:56)
at entry:whatwg-url (vendors-node_modules_taro_h5_prebundle_whatwg-url_js.js:3799:26)

环境信息

👽 Taro v3.6.16

  Taro CLI 3.6.16 environment info:
    System:
      OS: Linux 6.2 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
      Shell: 5.1.16 - /bin/bash
    Binaries:
      Node: 18.17.1 - /var/www/software/nodejs/bin/node
      Yarn: 1.22.19 - /var/www/software/nodejs/bin/yarn
      npm: 9.6.7 - /var/www/software/nodejs/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.16 => 3.6.16 
      @tarojs/components: 3.6.16 => 3.6.16 
      @tarojs/helper: 3.6.16 => 3.6.16 
      @tarojs/plugin-framework-react: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-alipay: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-h5: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-jd: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-qq: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-swan: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-tt: 3.6.16 => 3.6.16 
      @tarojs/plugin-platform-weapp: 3.6.16 => 3.6.16 
      @tarojs/react: 3.6.16 => 3.6.16 
      @tarojs/runtime: 3.6.16 => 3.6.16 
      @tarojs/shared: 3.6.16 => 3.6.16 
      @tarojs/taro: 3.6.16 => 3.6.16 
      @tarojs/taro-loader: 3.6.16 => 3.6.16 
      @tarojs/webpack5-runner: 3.6.16 => 3.6.16 
      babel-preset-taro: 3.6.16 => 3.6.16 
      eslint-config-taro: 3.6.16 => 3.6.16 
      react: ^18.0.0 => 18.2.0
taor4pac

taor4pac1#

貌似得关闭小程序本地设置里面的 将JS编译成ES5

相关问题