-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(@angular/cli): simplify import path if possible #6184
Conversation
1642923
to
8c57136
Compare
@@ -229,7 +229,8 @@ export default Blueprint.extend({ | |||
const className = stringUtils.classify(`${options.entity.name}Component`); | |||
const fileName = stringUtils.dasherize(`${options.entity.name}.component`); | |||
const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath); | |||
const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; | |||
const normalizeRelativeDir = componentDir.startsWith('.') ? componentDir : `./${componentDir}`; | |||
const importPath = componentDir ? `${normalizeRelativeDir}/${fileName}` : `./${fileName}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you instead use path.normalize
on importPath
? It guarantees the path is always simplified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly path.normalize
will simplify import {Hello} from './hello/hello'
to import {Hello} from 'hello/hello'
, which breaks the app...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not know that, you're right. Plus on windows it also replaces the slashes.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #6183