ERROR in ./src/app/app.module.ngfactory.js and Can't resolve @ngx-translate instances

Viewed 3586

I'm trying to do a server side rendering using Angular Universal. During the build process I can't resolve this issue:

ERROR in ./src/app/app.module.ngfactory.js Module not found: Error: Can't resolve '@ngx-translate/core/index' in '/Users/myUser/Documents/portal/src/app'

Angular CLI: 7.0.6 || Node: 9.4.0 || Angular: 7.0.4 || @ngx-translate/core: 11.0.1

Note: I tried --aot=false but I had this issue " The --build-optimizer option cannot be used without --aot."

Someone can help?

Let me know if you need more info

1 Answers

It is possible that it comes from the library exports. You can fix it by exporting the modules directly from the files and not from a barrel.

Instead of:

lib/my/my.service.ts
    export class MyService
lib/my/index.ts
    export { MyService } from './my.service'
lib/index.ts
    export { MyService } from './my'

You should try:

lib/my/my.service.ts
    export class MyService
lib/index.ts
    export { MyService } from './my/my.service'
Related