Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Handle ngModule decorators that do not have any args defined #958

Closed
mdcotter opened this issue Feb 8, 2017 · 1 comment
Closed

Handle ngModule decorators that do not have any args defined #958

mdcotter opened this issue Feb 8, 2017 · 1 comment
Assignees
Labels

Comments

@mdcotter
Copy link

mdcotter commented Feb 8, 2017

Came across a completely random bug when using @ngrx/router-store.

Uncaught TypeError: Cannot read property '0' of undefined
at chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:6514:115
at Array.reduce (native)
at resolveNgModuleDecoratorConfig (chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:6513:30)
at chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:6627:42
at Array.forEach (native)
at _parseModule (chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:6622:22)
at Object.exports.parseModules (chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:6521:15)
at parseInitialModules (chrome-extension://elgalmkoelokbchhkhacckoklkejnhcd/build/backend.js:9405:43)
at ZoneDelegate.invokeTask (http://localhost:4200/vendor.bundle.js:87182:35)
at Zone.runTask (http://localhost:4200/vendor.bundle.js:87058:47)
at ZoneTask.invoke (http://localhost:4200/vendor.bundle.js:87252:33)
at data.args.(anonymous function) (http://localhost:4200/vendor.bundle.js:88283:25)

this came from importing the RouterStoreModule.connectRouter() in the main AppModule.

I dug into their code to find that they are defining that modules decorators as such
RouterStoreModule.decorators = [ { type: NgModule } ];
with no args defined, which causes the error above. If i update it manually to
RouterStoreModule.decorators = [ { type : NgModule, args : [{},] } ];
then it works.

Are you able to add a check to see if args exists before trying to access?

@stevenkampen
Copy link
Contributor

@mdcotter Thanks for the report. Bug is fixed and will be in the new release that happens tomorrow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants