TypeError: Object doesn't support property or method 'entries' (IE11)
TypeError: Object doesn't support property or method 'entries' (IE11)
我有一个用 Aurelia 编写的应用程序需要 运行 在 IE11 中。
直到上周,该应用程序 运行 正常,但现在我在尝试 运行 时在控制台中收到以下错误
TypeError: Object doesn't support property or method 'entries'
我不知道是什么原因造成的。我回到了一个月前的提交,该应用程序在 IE11 中肯定可以运行,但我得到了同样的错误。
我们正在使用 Yarn
与 Webpack
进行包管理
完整的堆栈转储是:
{
[functions]: ,
__proto__: { },
__symbol:__symbol:rxSubscriber0.6484791277649529: undefined,
__symbol:hasInstance0.64847912776495296: undefined,
__symbol:isConcatSpreadable0.64847912776495297: undefined,
__symbol:iterator0.64847912776495291: undefined,
__symbol:match0.64847912776495292: undefined,
__symbol:replace0.64847912776495293: undefined,
__symbol:search0.64847912776495294: undefined,
__symbol:species0.64847912776495299: undefined,
__symbol:split0.64847912776495295: undefined,
__symbol:toPrimitive0.648479127764952910: undefined,
__symbol:toStringTag0.648479127764952911: undefined,
__symbol:unscopables0.64847912776495298: undefined,
description: "Object doesn't support property or method 'entries'",
message: "Object doesn't support property or method 'entries'",
name: "TypeError",
number: -2146827850,
stack: "TypeError: Object doesn't support property or method 'entries'
at createSelectors (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28145:9)
at target.prototype[] (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28176:13)
at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:36702:7)
at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38733:7)
at automate (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38678:5)
at ready (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48132:7)
at swap (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48161:5)
at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48682:9)
at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-2"
}
我已经尝试查看其他 SOF 帖子,但我无法找到关于我应该做什么的明确答案 - 谁能帮忙?
编辑:
我刚刚安装了 this polyfill 和 运行 Webpack,现在我收到这个错误:
ERROR [app-router] SyntaxError: Syntax error
"ERROR [app-router]"
{
[functions]: ,
__proto__: { },
__symbol:__symbol:rxSubscriber0.7605681080912143: undefined,
__symbol:hasInstance0.76056810809121436: undefined,
__symbol:isConcatSpreadable0.76056810809121437: undefined,
__symbol:iterator0.76056810809121431: undefined,
__symbol:match0.76056810809121432: undefined,
__symbol:replace0.76056810809121433: undefined,
__symbol:search0.76056810809121434: undefined,
__symbol:species0.76056810809121439: undefined,
__symbol:split0.76056810809121435: undefined,
__symbol:toPrimitive0.760568108091214310: undefined,
__symbol:toStringTag0.760568108091214311: undefined,
__symbol:unscopables0.76056810809121438: undefined,
description: "Syntax error",
message: "Syntax error",
name: "SyntaxError",
number: -2146827286,
stack: "SyntaxError: Syntax error
at tryCatcher (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:6757:9)
at Promise.prototype._settlePromiseFromHandler (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4779:9)
at Promise.prototype._settlePromise (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4836:13)
at Promise.prototype._settlePromise0 (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4881:5)
at Promise.prototype._settlePromises (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4960:13)
at Async.prototype._drainQueue (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1689:13)
at Async.prototype._drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1699:5)
at drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1573:9)
"
}
正如人们所提到的,解决这个问题的方法是实施以下 polyfill
if (!Object.entries)
Object.entries = function (obj) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
我有一个用 Aurelia 编写的应用程序需要 运行 在 IE11 中。
直到上周,该应用程序 运行 正常,但现在我在尝试 运行 时在控制台中收到以下错误
TypeError: Object doesn't support property or method 'entries'
我不知道是什么原因造成的。我回到了一个月前的提交,该应用程序在 IE11 中肯定可以运行,但我得到了同样的错误。
我们正在使用 Yarn
与 Webpack
完整的堆栈转储是:
{
[functions]: ,
__proto__: { },
__symbol:__symbol:rxSubscriber0.6484791277649529: undefined,
__symbol:hasInstance0.64847912776495296: undefined,
__symbol:isConcatSpreadable0.64847912776495297: undefined,
__symbol:iterator0.64847912776495291: undefined,
__symbol:match0.64847912776495292: undefined,
__symbol:replace0.64847912776495293: undefined,
__symbol:search0.64847912776495294: undefined,
__symbol:species0.64847912776495299: undefined,
__symbol:split0.64847912776495295: undefined,
__symbol:toPrimitive0.648479127764952910: undefined,
__symbol:toStringTag0.648479127764952911: undefined,
__symbol:unscopables0.64847912776495298: undefined,
description: "Object doesn't support property or method 'entries'",
message: "Object doesn't support property or method 'entries'",
name: "TypeError",
number: -2146827850,
stack: "TypeError: Object doesn't support property or method 'entries'
at createSelectors (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28145:9)
at target.prototype[] (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:28176:13)
at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:36702:7)
at bind (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38733:7)
at automate (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:38678:5)
at ready (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48132:7)
at swap (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48161:5)
at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-24hxcAM:48682:9)
at Anonymous function (http://localhost:51158/dist/app.js?v=Q8Lj1h7qjQUyqYO52tjHs-75tv3cmxHiL7p-2"
}
我已经尝试查看其他 SOF 帖子,但我无法找到关于我应该做什么的明确答案 - 谁能帮忙?
编辑:
我刚刚安装了 this polyfill 和 运行 Webpack,现在我收到这个错误:
ERROR [app-router] SyntaxError: Syntax error
"ERROR [app-router]"
{
[functions]: ,
__proto__: { },
__symbol:__symbol:rxSubscriber0.7605681080912143: undefined,
__symbol:hasInstance0.76056810809121436: undefined,
__symbol:isConcatSpreadable0.76056810809121437: undefined,
__symbol:iterator0.76056810809121431: undefined,
__symbol:match0.76056810809121432: undefined,
__symbol:replace0.76056810809121433: undefined,
__symbol:search0.76056810809121434: undefined,
__symbol:species0.76056810809121439: undefined,
__symbol:split0.76056810809121435: undefined,
__symbol:toPrimitive0.760568108091214310: undefined,
__symbol:toStringTag0.760568108091214311: undefined,
__symbol:unscopables0.76056810809121438: undefined,
description: "Syntax error",
message: "Syntax error",
name: "SyntaxError",
number: -2146827286,
stack: "SyntaxError: Syntax error
at tryCatcher (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:6757:9)
at Promise.prototype._settlePromiseFromHandler (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4779:9)
at Promise.prototype._settlePromise (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4836:13)
at Promise.prototype._settlePromise0 (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4881:5)
at Promise.prototype._settlePromises (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:4960:13)
at Async.prototype._drainQueue (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1689:13)
at Async.prototype._drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1699:5)
at drainQueues (http://localhost:51158/dist/app.js?v=yJ9KRojv8-WpvAUoTKrlQU3TjmNSInH-YMQzLwKD_0g:1573:9)
"
}
正如人们所提到的,解决这个问题的方法是实施以下 polyfill
if (!Object.entries)
Object.entries = function (obj) {
var ownProps = Object.keys(obj),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};