hello does anyone have …

less than 1 minute read

hello, does anyone have some hints for best practice here? I have multiple apps in my nx workspace, each of them import the same 3rd party modules, some of them using a forRoot method. I want to have a single import instead of having 5-6 imports in every AppModule… should I just go and create a shared module, that imports/exports those 3rd party libs and somehow make sure, that this shared module is only imported once in the root of every app?

Responses:

Yup! That’s what we do. But only for modules that are related is our role

Rule**

what do you mean by “related” ? do you have an example of your rule for each case?

Ya! So we have some modules that manage our NGRX Data state for example that imports the different entity metadata constants and stuff like that. So we have one library that imports and “forRoot”’s our ngrx data module then that can be imported into the apps that need the ngrx data state! It doesn’t work for everything but it does for some stuff.

Updated: