Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

bug(schematics): Generated modules are imported with an incorrect relative path when flat option is used #355

Closed
@dkuerner

Description

@dkuerner

Bug Report or Feature Request (mark with an x)

- [x] bug report 
- [ ] feature request

Area

- [ ] devkit
- [ x] schematics

Versions

Windows 7 / Ubuntu 14.04.5 LTS
$ node --version
v8.9.3
$ npm --version
5.5.1
"@angular-devkit/schematics": "~0.0.42"

Repro steps

  1. Initialize a new angular cli project, i.e. ng new mycustomproject
  2. cd into the created project
  3. create a new module including the flat option via angular/cli, i.e.: ng generate module toplevel --flat --module=app

The log given by the failure

vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ ng generate module toplevel --flat --module=app
create src/app/toplevel.module.ts (192 bytes)
update src/app/app.module.ts (389 bytes)
vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ cat src/app/
app.component.css app.component.html app.component.spec.ts app.component.ts app.module.ts toplevel.module.ts
vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ cat src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { ToplevelModule } from './/toplevel.module';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ToplevelModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Desired functionality

vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ ng generate module toplevel --flat --module=app
create src/app/toplevel.module.ts (192 bytes)
update src/app/app.module.ts (389 bytes)
vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ cat src/app/
app.component.css app.component.html app.component.spec.ts app.component.ts app.module.ts toplevel.module.ts
vagrant@vagrant-ubuntu-trusty-64:/projects/mycustomproject$ cat src/app/app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { ToplevelModule } from './toplevel.module';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
ToplevelModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Mention any other details that might be useful

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions