Scully: Internet Explorer 11 compatibility

Created on 10 Apr 2020  路  10Comments  路  Source: scullyio/scully

馃悶 Bug report

Description

After adding Scully, app doesn't work in IE 11 anymore.

馃敩 Minimal Reproduction


ng new scully-error
ng build
Open in IE 11, works
ng add @scullyio\init
ng build
Open in IE 11, error, no app displayed at all
Error: TypeError Object doesn't support his action

馃捇Your Environment

Angular Version:


Angular CLI: 9.1.1
Node: 12.16.1
OS: win32 x64

Angular: 9.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Scully Version:


    "@scullyio/init": "0.0.23",
    "@scullyio/ng-lib": "latest",
    "@scullyio/scully": "latest",

馃敟 Exception or Error


TypeError: Object doesn't support this action
   {
      [functions]: ,
      __proto__: { },
      description: "Object doesn't support this action",
      message: "Object doesn't support this action",
      name: "TypeError",
      number: -2146827843,
      stack: "TypeError: Object doesn't support this action
   at IdleMonitorService (http://localhost/vendor-es5.js:87056:9)
   at IdleMonitorService_Factory (http://localhost/vendor-es5.js:87362:9)
   at hydrate (http://localhost/vendor-es5.js:32065:13)
   at get (http://localhost/vendor-es5.js:31735:19)
   at injectInjectorOnly (http://localhost/vendor-es5.js:13480:9)
   at 傻傻inject (http://localhost/vendor-es5.js:13493:7)
   at ScullyLibModule_Factory (http://localhost/vendor-es5.js:88198:9)
   at hydrate (http://localhost/vendor-es5.js:32065:13)
   at get (http://localhost/vendor-es5.js:31735:19)
   at Anonymous function (http://localhost/vendor-es5.js:31785:13)",
      Symbol()_8.jdr2uhu1ip9: undefined,
      Symbol(INITIAL_VALUE)_j.jdr2uhu1ip9: undefined,
      Symbol(rxSubscriber)_i.jdr2uhu1ip9: undefined
   }
question

Most helpful comment

Polyfill above is not working. Whoever is searching for a working Polyfill use the following one, install it and add it to your Polyfills.ts

https://www.npmjs.com/package/new-event-polyfill

All 10 comments

I reproduce it.

Though ng build only generates the distribution files.
In order to use Scully pre rendering features, you need to use npm run scully after as stated in the documentation.
Doing so it works as intended on IE11.

Ok, I'll check it out and report back. Thanks, @geromegrignon!

Make sure you use the dist/static folder

Although page does load (you can see the default Angular app on the screen) it still displaying the same error in the console.

On my app that I'm trying to use this on, page loads, but because of error all JavaScript is then not running, which means page features are not working properly.

Error:


TypeError: Object doesn't support this action
   {
      [functions]: ,
      __proto__: { },
      description: "Object doesn't support this action",
      message: "Object doesn't support this action",
      name: "TypeError",
      number: -2146827843,
      stack: "TypeError: Object doesn't support this action
   at IdleMonitorService (http://localhost/vendor-es5.js:87056:9)
   at IdleMonitorService_Factory (http://localhost/vendor-es5.js:87362:9)
   at hydrate (http://localhost/vendor-es5.js:32065:13)
   at get (http://localhost/vendor-es5.js:31735:19)
   at injectInjectorOnly (http://localhost/vendor-es5.js:13480:9)
   at 傻傻inject (http://localhost/vendor-es5.js:13493:7)
   at ScullyLibModule_Factory (http://localhost/vendor-es5.js:88198:9)
   at hydrate (http://localhost/vendor-es5.js:32065:13)
   at get (http://localhost/vendor-es5.js:31735:19)
   at Anonymous function (http://localhost/vendor-es5.js:31785:13)",
      Symbol()_8.c2uoks36qms: undefined,
      Symbol(INITIAL_VALUE)_j.c2uoks36qms: undefined,
      Symbol(rxSubscriber)_i.c2uoks36qms: undefined
   }

@kjbetz You might be missing a polyfill you need.
We have customers running with IE11, so it should not be an issue. There is stuff in Scully that only works on modern browsers, but that is used during rendering only.

You need the customEvent ployfill as documented on MDN

(function () {

  if ( typeof window.CustomEvent === "function" ) return false;

  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: null };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;
   }

  window.CustomEvent = CustomEvent;
})();

When you add that to your polyfill, it should work.

I will close this issue now, but if you have additional questions, don't hesitate to ask.
@jorgeucano do we have a IE11 docs page where we can add this?

I was never able to get it work... either in my project or from a clean new Angular 9 application. I tried adding polyfills, etc... same error.

I eventually took out the ScullyLib from my app module since I'm not really using it. And just ran the scully command to generate the static site.

You need the customEvent ployfill as documented on MDN

(function () {

  if ( typeof window.CustomEvent === "function" ) return false;

  function CustomEvent ( event, params ) {
    params = params || { bubbles: false, cancelable: false, detail: null };
    var evt = document.createEvent( 'CustomEvent' );
    evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
    return evt;
   }

  window.CustomEvent = CustomEvent;
})();

When you add that to your polyfill, it should work.

I will close this issue now, but if you have additional questions, don't hesitate to ask.
@jorgeucano do we have a IE11 docs page where we can add this?

You have not solve this issue i think

you use new Event()

https://github.com/scullyio/scully/blob/main/libs/ng-lib/src/lib/idleMonitor/idle-monitor.service.ts#L52

polyfilll implements CustomEvent -> usage should be like:
e = document.createEvent('CustomEvent') and then e.initCustomEvent(...)

Polyfill above is not working. Whoever is searching for a working Polyfill use the following one, install it and add it to your Polyfills.ts

https://www.npmjs.com/package/new-event-polyfill

@dyingangel666 Thank you! Worked for me by installing and adding it to my polyfills.ts

Was this page helpful?
0 / 5 - 0 ratings