Transloco: Having transloco-root.module confuses Angular CLI generator

Created on 29 Jul 2020  路  6Comments  路  Source: ngneat/transloco

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

When invoking the Angular CLI generator for items that require importing (components/pipes/etc.), we get the error More than one module matches. Use the skip-import option to skip importing the component into the closest module or use the module option to specify a module. Manually specifying --module app.module is required.

Expected behavior

The Angular CLI generator should work as expected. This also breaks Nx generator, which uses Angular CLI underneath.

Minimal reproduction of the problem with instructions

  1. Create a new project using Angular CLI (ng new hello)
  2. Add Transloco as mentioned in the docs (cd hello && ng add @ngneat/transloco)
  3. Generate a component (ng g c foo)

Environment


Angular version: 10.0.6


For Tooling issues:
- Node version: 10  
- Platform:  Mac 


All 6 comments

@karmasakshi thanks for bringing that up...
The solution for this will be to put the transloco-root.module under a folder named /transloco in the app root module, would you like to create a PR that solves that?

@itayod Sure.

@itayod Sorry, first-time contributor here. How can I check if this fixed the issue?

Do you know why the CLI doesn't get confused with app-routing.module? If it's a naming convention or a config in angular.json I think we could leverage that.

@karmasakshi in order to test it you can run build the schematics or run schematics:watch for dev, then create a test project and run npm link transloco-schematics then you will be able to run the add command as following: ng g transloco-schematics:init

Do you know why the CLI doesn't get confused with app-routing.module? If it's a naming convention or a config in angular.json I think we could leverage that.

Sure, they actually handle it hard codedly by specifically ignoring -routing.module files :)

Was this page helpful?
0 / 5 - 0 ratings