Uncaught TypeError: Object.values is not a function

Uncaught TypeError: Object.values is not a function

好的,我 npm run build 我的应用程序,将构建文件拖到 tizon studio 中。
运行 申请... 我收到错误:

2.bd938b3f.chunk.js:79798 Uncaught TypeError: Object.values is not a function

在我测试过的任何三星和 Tizon 型号上都显示了相同的行为。

我试过将 Object.values 换成 Object.map, 其中 returns "the same" 错误。

2.bd938b3f.chunk.js:79798 Uncaught TypeError: Object.map is not a function

我找不到解决此问题的答案。
任何帮助寻找答案的帮助将不胜感激。
提前谢谢大家!

if (!le) {
    (function () {
        for (var e = window.document.getElementsByTagName("script"), t = 0, n = Object.values(e); t < n.length; t++) {
            var r = n[t];
            if (r.src && r.src.includes(te))
                return r
        }
        return null
    })() || function (e) {
        var t = document.createElement("script");
        t.src = te + "?l=" + e,
            t.async = !0,
            document.head.appendChild(t)
    }
            (ue),
        function (e) {
            var t = [];
            Array.isArray(window[e]) ? t = window[e] : window[e] = t
        }
            (ue);
    var r = ne(se, ue, ce),
        i = r.wrappedGtag,
        a = r.gtagCore;
    ie = i,
        re = a,
        le = !0
}

您的开发环境似乎不支持 Object.values()。尝试在脚本文件顶部添加此 polyfill:https://github.com/tc39/proposal-object-values-entries/blob/master/polyfill.js

Samsung 的 TizenOS javascript 不是最新的,据 this 看来没有得到积极支持。

您可以使用 react-app-polyfill 来提供任何缺失的功能。

我们在根 index.jsx 中使用以下内容作为 polyfills

的 "kitchen sink"
import 'react-app-polyfill/ie9';
import 'react-app-polyfill/stable';

如果节点版本太低,您可以定义自己的值函数。

if (!Object.values) {
    Object.values = function values(O) {
        return Object.keys(O).map(k=>O[k]);
    };
}