Search code examples
internet-explorer-11single-spasingle-spa-angular

I have created single-spa application using create single-spa and its working fine in all browser except IE11


IE11 error while running app

Note: I have added core.js dependency, still getting error in IE


Solution

  • Have you added the following scripts to make single-spa work in IE 11?

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

    Besides, Webpack 5 which is used in single-spa doesn't support IE11 by default. To make it support IE11, you need to specify target: ['web', 'es5'] in the webpack.config.js.

    For more inforamtion, you can refer to this similar thread. If you still can't make it work in IE11, you can use this working sample. It works well in IE11 and other browsers.

    enter image description here