【问题标题】:I have created single-spa application using create single-spa and its working fine in all browser except IE11我已经使用 create single-spa 创建了 single-spa 应用程序,它在除 IE11 之外的所有浏览器中都能正常工作
【发布时间】:2021-04-02 15:49:44
【问题描述】:

IE11 error while running app

注意:我添加了 core.js 依赖,在 IE 中仍然报错

【问题讨论】:

    标签: internet-explorer-11 single-spa single-spa-angular


    【解决方案1】:

    您是否添加了以下脚本以使 single-spa 在 IE 11 中工作?

    <script>
      if (typeof fetch === 'undefined') {
        document.write('<script src="https://cdn.jsdelivr.net/npm/whatwg-fetch@3.4.0/dist/fetch.umd.js"><\/script>')
      }
      if (typeof String.prototype.startsWith === 'undefined' || typeof Promise === 'undefined') {
        document.write('<script src="https://cdn.jsdelivr.net/npm/@babel/polyfill@7.10.4/dist/polyfill.min.js"><\/script>')
      }
    </script>
    

    另外,single-spa 中使用的 Webpack 5 默认不支持 IE11。要使其支持 IE11,您需要在 webpack.config.js 中指定 target: ['web', 'es5']

    更多信息可以参考this similar thread。如果还是不能在 IE11 中运行,可以使用this working sample。它在 IE11 和其他浏览器中运行良好。

    【讨论】:

      猜你喜欢
      • 2021-07-04
      • 2022-01-23
      • 2022-01-03
      • 2020-09-07
      • 2022-10-18
      • 2022-12-21
      • 1970-01-01
      • 2013-08-31
      • 1970-01-01
      相关资源
      最近更新 更多