我们正在建立V2 Docusaurus网站:https://www.10studio.tech。
我们刚刚意识到它在IE11中无法很好地工作。错误消息是:Object doesn't support property or method 'assign'
。
有些软件包具有IE兼容性,例如core-js
,但我们不知道如何将其正确添加到Docusaurus v2中。
有人知道如何修改吗?
答案 0 :(得分:1)
错误消息告诉您该对象没有assign
function
。 assign
是一个function
,您正在使用的浏览器显然不支持它,因此您需要polyfill。一个很好的例子是:
if (!Object.assign) {
Object.defineProperty(Object, 'assign', {
enumerable: false,
configurable: true,
writable: true,
value: function(target) {
'use strict';
if (target === undefined || target === null) {
throw new TypeError('Cannot convert first argument to object');
}
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) {
continue;
}
nextSource = Object(nextSource);
var keysArray = Object.keys(Object(nextSource));
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) {
to[nextKey] = nextSource[nextKey];
}
}
}
return to;
}
});
}
可在此处找到:https://gist.github.com/spiralx/68cf40d7010d829340cb
但是,即使这可以解决您抱怨的问题,也很有可能还会发生其他问题。您可能还需要填充其他内容,您可能想看看BabelJS才能实现这一目标。