File tree 1 file changed +5
-3
lines changed
packages/@angular/cli/blueprints/component
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -238,9 +238,11 @@ export default Blueprint.extend({
238
238
const returns : Array < any > = [ ] ;
239
239
const className = stringUtils . classify ( `${ options . entity . name } Component` ) ;
240
240
const fileName = stringUtils . dasherize ( `${ options . entity . name } .component` ) ;
241
- const componentDir = path . relative ( path . dirname ( this . pathToModule ) , this . generatePath ) ;
242
- const normalizeRelativeDir = componentDir . startsWith ( '.' ) ? componentDir : `./${ componentDir } ` ;
243
- const importPath = componentDir ? `${ normalizeRelativeDir } /${ fileName } ` : `./${ fileName } ` ;
241
+ const fullGeneratePath = path . join ( this . project . root , this . generatePath ) ;
242
+ const moduleDir = path . parse ( this . pathToModule ) . dir ;
243
+ const relativeDir = path . relative ( moduleDir , fullGeneratePath ) ;
244
+ const normalizeRelativeDir = relativeDir . startsWith ( '.' ) ? relativeDir : `./${ relativeDir } ` ;
245
+ const importPath = relativeDir ? `${ normalizeRelativeDir } /${ fileName } ` : `./${ fileName } ` ;
244
246
245
247
if ( ! options . skipImport ) {
246
248
if ( options . dryRun ) {
You can’t perform that action at this time.
0 commit comments