Skip to content

Object.hasOwn is not a function #5949

@wszgrcy

Description

@wszgrcy

发行方式

App

具体平台

android 16

开发环境

Windows

项目创建方式

CLI命令行

Vue 版本

vue3

依赖版本

 "@dcloudio/uni-app": "3.0.0-4080720251210001",

问题描述

之前的问题
#5947 (comment)
感谢提醒,我又打包了一次,这次我把所有代码都删除掉了,只保留了一个空页面,然后在app.Vue中打印
问题仍然存在;理论上来讲chrome 133绝对支持这个语法,但是实际上打印就是undefined
代码

console.log(Object);
console.log(Object.hasOwn);
console.log(typeof Object.hasOwn);
console.log(uni.getSystemInfoSync());

日志

2026-02-28 22:13:20.773  3964-3988  console                 test.c                            I  [LOG]function Object() { [native code] } at App.vue:2
2026-02-28 22:13:20.773  3964-3988  console                 test.c                            I  [LOG]---UNDEFINED--- at App.vue:3
2026-02-28 22:13:20.773  3964-3988  console                 test.c                            I  [LOG]undefined at App.vue:4
2026-02-28 22:13:20.796  3964-3988  console                 test.c                            I  [LOG][___Connect_41691429___]---BEGIN:JSON---{"SDKVersion":"","appId":"xxxx","appLanguage":"en","appName":"test","appVersion":"1.0","appVersionCode":1,"appWgtVersion":"1.0.0","brand":"unknown","browserName":"chrome","browserVersion":"133.0.6943.137","deviceBrand":"unknown","deviceId":"34933C635BBFD79CCCF3E018150B280E","deviceModel":"Android SDK built for x86_64","deviceOrientation":"portrait","devicePixelRatio":3,"deviceType":"phone","isUniAppX":false,"language":"en-US","model":"Android SDK built for x86_64","oaid":"","osAndroidAPILevel":36,"osLanguage":"en-US","osName":"android","osTheme":"light","osVersion":"16","pixelRatio":3,"platform":"android","romName":"Android","romVersion":"16","safeArea":{"left":0,"right":427,"top":24,"bottom":952,"width":427,"height":928},"safeAreaInsets":{"top":24,"right":0,"bottom":0,"left":0},"screenHeight":952,"screenWidth":427,"statusBarHeight":24,"system":"Android 16","ua":"Mozilla/5.0 (Linux; Android 16; Android SDK built for x86_64 Build/BE2A.250530.026.D1; wv) AppleWe
2026-02-28 22:13:20.796  3964-3988  console                 test.c                           I  [LOG][___Connect_41691429___]bKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/133.0.6943.137 Mobile Safari/537.36 uni-app Html5Plus/1.0 (Immersed/24.0)","uniCompileVersion":"4.87","uniCompilerVersion":"4.87","uniPlatform":"app","uniRuntimeVersion":"4.87","version":"1.9.9.82540","windowBottom":0,"windowHeight":952,"windowTop":0,"windowWidth":427}---END:JSON--- at App.vue:5[___Connect_41691429___END]

编译后的代码

if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
  Promise.prototype.finally = function(callback) {
    const promise = this.constructor;
    return this.then(
      (value) => promise.resolve(callback()).then(() => value),
      (reason) => promise.resolve(callback()).then(() => {
        throw reason;
      })
    );
  };
}
;
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
  const global = uni.requireGlobal();
  ArrayBuffer = global.ArrayBuffer;
  Int8Array = global.Int8Array;
  Uint8Array = global.Uint8Array;
  Uint8ClampedArray = global.Uint8ClampedArray;
  Int16Array = global.Int16Array;
  Uint16Array = global.Uint16Array;
  Int32Array = global.Int32Array;
  Uint32Array = global.Uint32Array;
  Float32Array = global.Float32Array;
  Float64Array = global.Float64Array;
  BigInt64Array = global.BigInt64Array;
  BigUint64Array = global.BigUint64Array;
}
;
if (uni.restoreGlobal) {
  uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
}
(function(vue) {
  "use strict";
  const _export_sfc = (sfc, props) => {
    const target = sfc.__vccOpts || sfc;
    for (const [key, val] of props) {
      target[key] = val;
    }
    return target;
  };
  const _sfc_main$1 = {};
  function _sfc_render(_ctx, _cache) {
    return vue.openBlock(), vue.createElementBlock("view", null, "111");
  }
  const PagesEmptyIndex = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render]]);
  __definePage("pages/empty/index", PagesEmptyIndex);
  function formatAppLog(type, filename, ...args) {
    if (uni.__log__) {
      uni.__log__(type, filename, ...args);
    } else {
      console[type].apply(console, [...args, filename]);
    }
  }
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
    __name: "App",
    setup(__props) {
      formatAppLog("log", "at App.vue:2", Object);
      formatAppLog("log", "at App.vue:3", Object.hasOwn);
      formatAppLog("log", "at App.vue:4", typeof Object.hasOwn);
      formatAppLog("log", "at App.vue:5", uni.getSystemInfoSync());
      return () => {
      };
    }
  });
  function createApp() {
    const app = vue.createVueApp(_sfc_main);
    return {
      app
    };
  }
  const { app: __app__, Vuex: __Vuex__, Pinia: __Pinia__ } = createApp();
  uni.Vuex = __Vuex__;
  uni.Pinia = __Pinia__;
  __app__.provide("__globalStyles", __uniConfig.styles);
  __app__._component.mpType = "app";
  __app__._component.render = () => {
  };
  __app__.mount("#app");
})(Vue);

chrome debug

Image

重现步骤

  1. 输出 Object.hasOwn

期望行为

No response

实际行为

No response

截图或录屏

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions