I'm facing difficulties trying to figure out why I can't register my effects with NgRx version 7.4.0. Despite simplifying my effects class in search of a solution, I keep encountering the following error:
main.79a79285b0ad5f8b4e8a.js:33529 Uncaught TypeError: ctor is not a constructor
at _createClass (main.79a79285b0ad5f8b4e8a.js:33529)
at _createProviderInstance (main.79a79285b0ad5f8b4e8a.js:33501)
at initNgModule (main.79a79285b0ad5f8b4e8a.js:33432)
at new NgModuleRef_ (main.79a79285b0ad5f8b4e8a.js:34161)
at Object.createNgModuleRef (main.79a79285b0ad5f8b4e8a.js:34150)
at NgModuleFactory_.push../node_modules/@angular/core/fesm5/core.js.NgModuleFactory_.create (main.79a79285b0ad5f8b4e8a.js:36687)
at main.79a79285b0ad5f8b4e8a.js:30069
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.f00ff83aa2c2b28f8bcd.js:7646)
at Object.onInvoke (main.79a79285b0ad5f8b4e8a.js:29604)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.f00ff83aa2c2b28f8bcd.js:7645)
The module definition is as follows:
@NgModule({
imports: [
CommonModule,
StoreModule.forRoot({settings: settingsReducer}),
EffectsModule.forRoot([SettingsEffects])
],
declarations: [/*..other declarations..*/],
exports: [/*..other exports..*/],
providers: [/*..other providers..*/],
})
export class MyModule {
}
The dependencies listed in my package.json
:
"dependencies": {
"@ngrx/effects": "7.4.0",
"@ngrx/router-store": "7.4.0",
"@ngrx/store": "7.4.0",
"@ngrx/store-devtools": "7.4.0",
"ng2-translate": "5.0.0"
},
My dev dependencies are as follows:
"devDependencies": {
"@angular/common": "7.2.15",
"@angular/compiler": "7.2.15",
...
}
The SettingsEffects
class that I have simplified looks like this:
@Injectable()
export class SettingsEffects {
constructor(
private actions$: Actions
) {
}
}
Even in its original state, the SettingsEffects
class triggers the same error.
If I remove the line:
EffectsModule.forRoot([SettingsEffects])
from the imports, the application launches successfully; however, the effects do not execute, which isn't ideal.
Despite searching extensively online, I haven't found any clues as to why this issue persists. This module is part of a library imported into the app's main GUI, and we have ensured there are no conflicting package versions; everything uses version 7.4.0 of the store modules.
I would greatly appreciate any assistance! I've been grappling with this problem for a whole day now!