Office.js onReady/initialize 无法在 Internet Explorer 上运行

Office.js onReady/initialize not working on Internet Explorer

当 运行在 Internet Explorer 中添加一个插件时(或者使用 Internet explorer 运行 插件的旧版本的 Office 365,而不是像新版本的 Office 35 那样的 Edge)我明白了抛出错误:

SCRIPT5022: Office.js has not fully loaded. Your app must call "Office.onReady()" as part of it's loading sequence (or set the "Office.initialize" function). If your app has this functionality, try reloading this page.

但是,它在最新版本的 Office(内部使用 Edge 运行 插件)以及使用 Chrome 作为浏览器的 Office online 中运行良好。

作为参考,这里是我们index.js的相关部分:

import "core-js/stable";
import "regenerator-runtime/runtime";
import React from "react";
import ReactDOM from "react-dom";
import { initializeIcons } from "@uifabric/icons";
import App from "./App";

Office.initialize = () => {};

Office.onReady(() => {
  console.log("Office ready!");
  initializeIcons();
  ReactDOM.render(<App />, document.getElementById("root"));
});

如有任何帮助,我们将不胜感激!

发现我们使用的一些节点模块不支持IE11。禁用这些节点模块修复了它。最后跟office-js本身没有关系

对于任何感兴趣的人,在 IE11 中破坏应用程序的节点模块是:

  • 查询字符串
  • mobx(版本 5)