angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
95.88k stars 25.32k forks source link

Uncaught (in promise): Cannot read property 'call' of undefined #26389

Closed gowthamr123 closed 5 years ago

gowthamr123 commented 5 years ago

Versions

"devDependencies": { "@angular-devkit/build-angular": "^0.7.0-rc.0", "@angular/cli": "^6.2.3", "@angular/compiler-cli": "^6.1.8", "@angular/language-service": "^6.0.3", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~1.7.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.0", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "pre-commit": "^1.2.2", "protractor": "~5.3.0", "ts-node": "~5.0.1", "tslint": "~5.9.1", "typescript": "~2.7.2" }

Repro steps

Getting following error when using external angular elements (webcomponents) in my angular application.

error

It occurs only when building in production mode (ng build --prod), when optimisation is set true and with lazy loading.

headerfooter is a JS file that is generated as part of webcomponent. Following is the AppModule file of webcomponent.



Git repo :

https://github.com/gowthamr123/repro-app

after running npm install do ng serve and go to below url :

http://localhost:4200/selfcare/tariff-change

It will work fine.

Now run in production mode ng serve --prod

Error occurs :

Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined

Following is the index.html of end application where I am using angular elements by including js files. **This issue occurs when using lazy loading and ng build --prod.**

### Desired functionality
ng build --prod should work correctly
igor-smi commented 5 years ago

I have the same problem

mhevery commented 5 years ago

Hello, we reviewed this issue and determined that it doesn't fall into the bug report or feature request category. This issue tracker is not suitable for support requests, please repost your issue on StackOverflow using tag angular.

If you are wondering why we don't resolve support issues via the issue tracker, please check out this explanation.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.