-
Notifications
You must be signed in to change notification settings - Fork 12k
The "ng generate" command does not work with custom "sourceRoot" property in "angular.json" #10702
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
Comments
Closing... |
@Brocco Please reopen this issue, it is different than #10653 . The issue described here is that It seems that the For comparison, it is working fine in Angular CLI 1.7.4 with Angular 5.2.10. In
Just to point out the difference, issue #10653 is that for some reasons |
@mwilkosinski, its the same problem, its getting your new source root, but it doesn’t find any module because its looking in the wrong place, as stated in #10653. If you want to confirm what i’m saying, generate a module before, it will put in the wrong place, then generate a component under that module, it will work, but everything will be in the wrong place. |
@matheusdavidson maybe the underlying cause is the same in both cases, I don't know, but on the surface these issues are different. Issue #10702: The So directory Issue #10653: The |
@mwilkosinski, update to 6.0.1, this update solved my problem, pretty sure it will fix yours. |
Same problem here, same example of the author, not working, running on 6.0.1 |
@gremo, did you update you local ng cli as well?
|
@matheusdavidson yes. Global angular cli install:
Then edit
|
I just ran into this issue myself. I am using the CLI with a .NET Core app and I have the code split into different folders. One for There is a workaround to get the CLI to generate the component/module/service/etc. in the correct location by using the (undocumented) $ ng generate service app.config --path=Client I found the if (options.path === undefined) {
const projectDirName = project.projectType === 'application' ? 'app' : 'lib';
options.path = `/${project.root}/src/${projectDirName}`;
} I still think this is an issue as it isn't actually using the configuration that is set in |
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. |
Versions
Repro steps
ng new xyz
src
directory tofoo
angular.json
change all occurrences ofsrc
tofoo
:ng g c bar
ng g c bar --skip-import
Observed behavior
ng g c bar
fails with an error:Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
ng g c bar --skip-import
creates the component in a wrong directory:Desired behavior
ng g c bar
generates componentbar
infoo/app/bar
The text was updated successfully, but these errors were encountered: