Cli 8.3.0 ES5 build browser errors (Unable to get property 'enumerable' of undefined or null)
🐞 Bug report
Command (mark with an x)
- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: ....In version 8.2.2 I have no issues
Description
After updating to cli 8.3.0 I suddenly noticed a load of different errors for browsers using the es5 versions such as
Uncaught (in promise): TypeError: Object prototype may only be an Object or null.
Object prototype may only be an Object or null.
Uncaught (in promise): TypeError: Unable to get property 'enumerable' of undefined or null reference
These errors seem to be occuring when loading lazy modules via the router, and the module will not load, but not all modules have an issue.
🔬 Minimal Reproduction
So far I've not been able to find the cause, the project it's happening on is pretty big so could take an age to narrow it down, all I know so far is everything works without issue when using 8.2.2.
🌍 Your Environment
Angular CLI: 8.3.0
Node: 10.16.0
OS: darwin x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.802.2
@angular-devkit/build-angular 0.802.2
@angular-devkit/build-optimizer 0.802.2
@angular-devkit/build-webpack 0.802.2
@angular-devkit/core 8.3.0
@angular-devkit/schematics 8.3.0
@angular/cdk 8.1.3
@angular/cli 8.3.0
@angular/flex-layout 8.0.0-beta.26
@angular/material 8.1.3
@angular/material-moment-adapter 8.1.3
@angular/pwa 0.801.3
@ngtools/webpack 8.2.2
@nguniversal/common 8.1.1
@nguniversal/express-engine 8.1.1
@nguniversal/module-map-ngfactory-loader 8.1.1
@schematics/angular 8.1.3
@schematics/update 0.803.0
rxjs 6.5.2
typescript 3.5.3
webpack 4.38.0
Anything else relevant?
Ok, so I have tried with both the guard and the polyfill, with no luck as this runs okish in IE11
@mpalourdio, by any chance do you have a full stacktrace of the error that you are getting?
@alan-agius4 I only have the error in console. But if you point me on what to do, I can quickly deploy the project with ng-cli 8.3.0 and copy/paste the stack trace. Just let me know.
Edit : redeploying now one project with ng-cli 8.3
"ERROR"
{
[functions]: ,
__proto__: {
[functions]: ,
__proto__: { },
message: "",
name: "TypeError",
Symbol()_6.2ef34fg5dw7: undefined,
Symbol(INITIAL_VALUE)_h.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_g.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_i.2ef34fg5dw7: undefined
},
description: "Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie",
message: "Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie",
name: "TypeError",
number: -2146823281,
stack: "TypeError: Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie
at e (https:/xxxx/5-es5.c58944658cbd734e2e82.js:1:275)
at bo (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:76428)
at po (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:75164)
at xu (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:112335)
at Mu (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:120147)
at Nu (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:119347)
at xu (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:112568)
at wu (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:111018)
at t ",
Symbol()_6.2ef34fg5dw7: undefined,
Symbol(INITIAL_VALUE)_h.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_g.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_i.2ef34fg5dw7: undefined
}
ERROR TypeError: Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie
"ERROR"
{
[functions]: ,
__proto__: { },
description: "Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie",
message: "Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie",
name: "TypeError",
number: -2146823281,
stack: "TypeError: Impossible d’obtenir la propriété « enumerable » d’une référence null ou non définie
at e (https://xxxx/5-es5.c58944658cbd734e2e82.js:1:275)
at bo (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:76428)
at po (https://ixxxxx/main-es5.b5f190e2953aaddb7646.js:1:75164)
at xu (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:112335)
at Mu (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:120147)
at Nu (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:119347)
at xu (https:/xxxx/main-es5.b5f190e2953aaddb7646.js:1:112568)
at wu (https://xxxx/main-es5.b5f190e2953aaddb7646.js:1:111018)
at t ",
Symbol()_6.2ef34fg5dw7: undefined,
Symbol(INITIAL_VALUE)_h.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_g.2ef34fg5dw7: undefined,
Symbol(rxSubscriber)_i.2ef34fg5dw7: undefined
}
@mpalourdio, I tried various things and I am still unable to reproduce the error. Would it be possible to privately share your application with the team?
@alan-agius4 Do you need to make the code run ? As it's tightly coupled with a java backend and some node_modules published internally on a 'nexus', it can be very difficult.
Otherwise I have no problem with sharing the project privately
Yeah, it would need to "run" to see the error in the browser. If you share the dist folder alone will I be able to see the mentioned error?
Let me give this a try with the dist folder.
@alan-agius4 mail sent from my corporate email@ (Sent at 15:02 GMT+2). EDIT2 : This message was blocked because its content presents a potential security issue.
I had 'regeneratorRuntime' is undefined
with ie11 and
"@angular-devkit/build-angular": "~0.803.0",
"@angular/cli": "^8.3.0",
only working solution was to downgrade to
"@angular-devkit/build-angular": "~0.802.2",
"@angular/cli": "^8.2.2",
browserlist did not help nor adding all polyfills by hand to polyfill.ts
edit: NG_BUILD_DIFFERENTIAL_FULL=1 works too
@alan-agius4 Sorry for spamming here, please delete once notified, but gmail antivirus rejected my mail. I have invited you in a private repo : https://github.com/mpalourdio/ngcli830-dist
@mpalourdio, can you also provide the unminified version of the code please? Thanks
@alan-agius4 added in a zip on the repo
I updated using ng update and boom got this warning
WARNING in budgets, maximum exceeded for initial. Budget 2 MB was exceeded by 82.5 kB.
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.
bundle.js is now 1.5mb with 8.2.2 it wasn't that big in size.
thanks @mpalourdio
We had 'regeneratorRuntime' is undefined first, then I added https://www.npmjs.com/package/regenerator-runtime and got a different error ("no platform exists!" error message coming from the polyfills file). Then I downgraded back to CLI 8.2. asap.
on CLI 8.3.1, When we use NGRX, Will have the 'regeneratorRuntime' is undefined issue in IE 11.....
Setting the NG_BUILD_DIFFERENTIAL_FULL environment variable to 1 also got rid of the error for me.
This is probably caused by #15246 as when I searched for what caused our issue, I found https://babeljs.io/docs/en/babel-polyfill where the regeneratorRuntime was mentioned.
I did an upgrade on our projects again to provide more info. We use nrwl/nx and monorepo-style development, we have shared libs and 2 apps.
Our larger app
- It works well in Chrome and we got error in IE 11 only.
- The initial error is:
SCRIPT5009: 'regeneratorRuntime' is undefined
vendor-es5.[hash].js (1,2700948)
- After adding
import "regenerator-runtime/runtime";to our polyfills, we got this error:
No platform exists!

Our smaller app
- It works well in Chrome and we got error in IE 11 only.
- The error message is:
SCRIPT5007: Invalid operand to 'in': Object expected
main-es5.[hash].js (1,109)
The generated code is:

So 2 apps, same (nx) project, similar setup, different error messages in IE 11.
@alan-agius4 I updated the process-bundle.js file in our node_modules with your updates from the PR to test, and I got the same errors described in my previous comment. Do you want me to create a new issue for those as the PR will close this issue?
@merobal, the first issue you are experiencing is not related to this one. With regards to the regenerator-runtime there is a PR for that https://github.com/angular/angular-cli/pull/15470
For the second issue make sure that you delete the cache prior to rebuilding after changing the code in build-angular using:
rm -rf node_modules/.cache
Can you check if you still get the 2nd error after that?