Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-xi18n Error: Unexpected value 'ServicesModule' imported by the module 'LoginModule' #13240

Closed
bahodirk opened this issue Dec 5, 2016 · 2 comments

Comments

@bahodirk
Copy link

bahodirk commented Dec 5, 2016

I'm submitting a ... (check one with "x")

[x] bug report

I have LoginModule

import { ServicesModule } from '@myservices/service';
import { ControlsModule } from '@mycontrols/controls';

@NgModule({
  imports: [
    CommonModule,
    ReactiveFormsModule,
    FormsModule,
    LOGIN_ROUTES,
    ServicesModule,
    ControlsModule
  ],
  declarations: [
    LoginComponent
  ],
  providers: [
    LOGIN_PROVIDERS
  ],
  exports: [
    LoginComponent
  ]
})

export class LoginModule { }
ServicesModule and ControlsModule are imported from another project (private npm repository).

AppModule looks as following:

@NgModule({
  imports: [
    BrowserModule,
    HttpModule,
    FormsModule,
    ReactiveFormsModule,
    RouterModule,
    ServicesModule,
    ControlsModule,
    ROUTES,
    LoginModule,
    SomeAnoterLocalModule
  ],
  declarations: [
    AppComponent
  ],
  providers: [
    { provide: LocationStrategy, useClass: HashLocationStrategy }
  ],
  bootstrap: [AppComponent]
})

I see that I am importing ServicesModule and ControlsModule both in LoginModule and AppModule, but otherwise it is not working.

When I run the project, everything works fine, no problem. However, when I run ng-xi18n to extract translation texts, I am getting an error:

Error: Unexpected value 'ServicesModule' imported by the module 'LoginModule'
I have tried to remove ServicesModule and ControlsModule from the "child" module (LoginModule) and keep import in AppModule, in that case I am getting an error that tags (selector) from ServicesModule and ControlsModule are not recognized.

The ServiceModule

@NgModule({
  imports: [
    HttpModule,
    RouterModule
  ],
  providers: [
    SERVICES_PROVIDERS
  ]
})

export class ServicesModule { }
It is only collection of services (providers).

Please tell us about your environment:

Angular version: 2.2.3
Browser: [Chrome Latest ]
Node: 6.9.1
TypeScript: 2.0.3

@alxhub
Copy link
Member

alxhub commented Dec 5, 2016

The private repository needs to publish metadata.json files for the modules. Compile it with ngc not tsc in order to do that. See @ngrx/store for an example of how to do this.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants