01-04-2018 05:29 AM
I have a common module where all the dependencies related to Alfresco are imported(containing CoreModule), now when I try to inject this common module inside my lazyloaded module it does not work.
Console Error :
ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common Rdirectives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
at new BrowserModule (platform-browser.js:4579)
at _createClass (core.js:10915)
at _createProviderInstance$1 (core.js:10889)
at initNgModule (core.js:10842)
at new NgModuleRef_ (core.js:12096)
at createNgModuleRef (core.js:12086)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.js:14430)
at NgModuleFactory_.create (core.js:15575)
at MapSubscriber.eval [as project] (router.js:4507)
at MapSubscriber._next (map.js:79)
at new BrowserModule (platform-browser.js:4579)
at _createClass (core.js:10915)
at _createProviderInstance$1 (core.js:10889)
at initNgModule (core.js:10842)
at new NgModuleRef_ (core.js:12096)
at createNgModuleRef (core.js:12086)
at Object.debugCreateNgModuleRef [as createNgModuleRef] (core.js:14430)
at NgModuleFactory_.create (core.js:15575)
at MapSubscriber.eval [as project] (router.js:4507)
at MapSubscriber._next (map.js:79)
at resolvePromise (zone.js:783)
at resolvePromise (zone.js:754)
at eval (zone.js:831)
at ZoneDelegate.invokeTask (zone.js:424)
at Object.onInvokeTask (core.js:4744)
at ZoneDelegate.invokeTask (zone.js:423)
at Zone.runTask (zone.js:191)
at drainMicroTaskQueue (zone.js:595)
01-04-2018 07:32 AM
This is a known issue and already in our backlog. To unblock development you can meanwhile use standard routes and switch to lazy loaded ones as soon as issue is resolved.
01-05-2018 06:32 AM
Our project structure and requirement does not allow to use standard routes.
We are left one option that is updating CoreModule and maintain it locally could you suggest some pointer for the same.
Thanks
01-05-2018 01:54 PM
If you know what needs to be done to make CoreModule fully compatible with the lazy loading (including Translate service I believe), then you could create a contribution pull request instead of maintaining a local copy.
01-09-2018 08:33 AM
With 2.1 release it should be possible using lazy-loaded modules, including i18n resources that a local to the lazy module.
02-14-2020 12:41 PM
Hello.
I have a shared-module where I'm importing all the alfresco modules (like CoreModule.forChild()) when I try to import that shared module in a lazy loading module, I have issues with the translation providers, it seems to load a TranslateFakeLoader instead of the TranslateLoaderService.
It runs twice the first time it catchs the TranslateLoaderService but then it catches the TranslateFakeLoader and blows when it tries to call the "setDefaultLang" (this.customLoader.setDefaultLang(this.defaultLang)#adf-core.js).
Note: I'm exporting the Alfresco modules on the sharedModule.
Can anyone help me please?
02-25-2020 09:27 AM
Hi @nelsonneves,
It's probably better to start this as a new thread (eventhough it's related) because people often overlook threads they've already read but not subscribed to.
HTH,
Explore our Alfresco products with the links below. Use labels to filter content by product module.