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

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

Closed
dkuerner opened this issue Jan 3, 2018 · 1 comment

Comments

@dkuerner
Copy link

dkuerner commented Jan 3, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants