-
Notifications
You must be signed in to change notification settings - Fork 572
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): import paths for child components #1208
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 3e4b8a7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 4 targetsSent with 💌 from NxCloud. |
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.
Awesome! Make sure to:
- run
yarn snapupdate
inpackages/core
to update snapshots. - run
yarn fmt:prettier
in the root dir to format the PR.
.join(', '); | ||
} | ||
|
||
return `import ${importValue} from '${importPath}';`; |
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.
I think you're missing wrapping brackets { }
, right now the PR imports the same default output, just under a different name. I don't think this is what you want?
Is this what's needed instead?
return `import ${importValue} from '${importPath}';`; | |
return `import {${importValue}} from '${importPath}';`; |
Description
Provides a default
importMapper
to the Angular generator to generate valid import statements for Angular module projects.For example, when importing a child component called
ChildComponent
, the import path will be generated as:I opted against assigning the
importMapper
to theDEFAULT_OPTIONS
, since the function needs context to whether the user has selected to generate for standalone components or not. With standalone enabled, the import mapper should not rewrite the import value to include theModule
postfix.Resolves #1205