I upgraded an Angular App from v8 to v9. The project imports a custom UI library using Angular 8 and moment.js.
When I build it:
WARNING in Entry point '@myLib/catalogue' contains deep imports into
'/Users/xyz/Projects/forms-frontend/node_modules/moment/locale/de'.
This is probably not a problem, but may cause the compilation of entry points to be out of order.
In the @myLib/catalogue.js
file of the library (inside node_modules folder), the moment.js DE locale is imported as following:
import 'moment/locale/de';
ERROR in Failed to compile entry-point @myLib/catalogue (es2015 as esm2015) due to compilation errors:
node_modules/@myLib/catalogue/fesm2015/catalogue.js:213:26 - error NG1010: Value at position 2 in the NgModule.imports of FormInputModule is not a reference: [object Object]
213 imports: [
~
214 CommonModule,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
219 TranslateModule
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220 ],
~~~~~~~~~~~~~~~~~
The text of the warning seems explaining exactly the compilation error, where the position (2 in this case) is out of range of the imports array.
I have seen different articles/github issues about deep-links, but no working solution.
you might have used npm i and the editor might fail to generate the build correctly. Try restarting your editor. Restarting worked for me. I was using VSCode
you need to change your custom build of modules, so you need to make analog changes to the ones below, in my case i needed to change:
export class ThemeModule {
static forRoot(): ModuleWithProviders {
return <ModuleWithProviders>{
ngModule: ThemeModule,
providers: [
...NbThemeModule.forRoot(
{
name: 'default',
},
[DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME, DARK_THEME],
).providers,
],
};
}
}
to:
export class ThemeModule {
static forRoot(): ModuleWithProviders<ThemeModule> {
return {
ngModule: ThemeModule,
providers: [
...NbThemeModule.forRoot(
{
name: 'default',
},
[DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME, DARK_THEME],
).providers,
],
};
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With