File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/@angular/cli/blueprints/component Expand file tree Collapse file tree 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({
238238 const returns : Array < any > = [ ] ;
239239 const className = stringUtils . classify ( `${ options . entity . name } Component` ) ;
240240 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 } ` ;
244246
245247 if ( ! options . skipImport ) {
246248 if ( options . dryRun ) {
You can’t perform that action at this time.
0 commit comments