Skip to content

Creating a module with --route & --routing creates duplicated & errored code #17139

Closed
@Maryannah

Description

@Maryannah

🐞 bug report

Affected Package

The issue is caused by the schematics that create a module

Is this a regression?

I do not know, I have never tried it before

Description

when running a command to create a module with --route & --routing, the code gets duplicated : there are routes in the *.module.ts along with the *-routing.module.ts

🔬 Minimal Reproduction

I didn't manage to create a stackblitz, but here are the commands to reproduce it locally.
npx create-nx-workspace@latest workspace
cd workspace
ng add @nrwl/angular --defaults
ng g @nrwl/angular:application app --style scss --routing true --prefix app
ng g m home --route home --module app.module.ts --routing true --project app

🌍 Your Environment

Angular Version:


    "@angular/animations": "^9.0.0",
    "@angular/cdk": "^9.0.0",
    "@angular/common": "^9.0.0",
    "@angular/compiler": "^9.0.0",
    "@angular/core": "^9.0.0",
    "@angular/flex-layout": "^9.0.0-beta.29",
    "@angular/forms": "^9.0.0",
    "@angular/material": "^9.0.0",
    "@angular/platform-browser": "^9.0.0",
    "@angular/platform-browser-dynamic": "^9.0.0",
    "@angular/router": "^9.0.0",
    "@nrwl/angular": "^9.0.4",

Anything else relevant?

I do not know if this is wanted or not, and I do not know which one is the best practice (the one to keep).

Here is a picture of the issue, in case it helps : you can see routes on the module, but also a routing module that is imported with it.

image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions