File tree 2 files changed +8
-4
lines changed
packages/angular-cli/blueprints
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,10 @@ module.exports = {
85
85
const returns = [ ] ;
86
86
const className = stringUtils . classify ( `${ options . entity . name } Directive` ) ;
87
87
const fileName = stringUtils . dasherize ( `${ options . entity . name } .directive` ) ;
88
- const componentDir = path . relative ( this . dynamicPath . appRoot , this . generatePath ) ;
89
- const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
88
+ const fullGeneratePath = path . join ( this . project . root , this . generatePath ) ;
89
+ const moduleDir = path . parse ( this . pathToModule ) . dir ;
90
+ const relativeDir = path . relative ( moduleDir , fullGeneratePath ) ;
91
+ const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
90
92
91
93
if ( ! options [ 'skip-import' ] ) {
92
94
returns . push (
Original file line number Diff line number Diff line change @@ -73,8 +73,10 @@ module.exports = {
73
73
const returns = [ ] ;
74
74
const className = stringUtils . classify ( `${ options . entity . name } Pipe` ) ;
75
75
const fileName = stringUtils . dasherize ( `${ options . entity . name } .pipe` ) ;
76
- const componentDir = path . relative ( this . dynamicPath . appRoot , this . generatePath ) ;
77
- const importPath = componentDir ? `./${ componentDir } /${ fileName } ` : `./${ fileName } ` ;
76
+ const fullGeneratePath = path . join ( this . project . root , this . generatePath ) ;
77
+ const moduleDir = path . parse ( this . pathToModule ) . dir ;
78
+ const relativeDir = path . relative ( moduleDir , fullGeneratePath ) ;
79
+ const importPath = relativeDir ? `./${ relativeDir } /${ fileName } ` : `./${ fileName } ` ;
78
80
79
81
if ( ! options [ 'skip-import' ] ) {
80
82
returns . push (
You can’t perform that action at this time.
0 commit comments