-
Notifications
You must be signed in to change notification settings - Fork 12k
Unable to generate a scoped library with v6 rc0 #10172
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
I suggest to generate a folder structure where the package name is a correct directory path structure - similar to how scoped packages are installed into the So when generating a scoped package with
Not only would it be compatible with npm layout. It is likely to work better with VSCode's auto-import suggestions. For example consider a monorepo folder structure similar to the Angular repos. You would probably generate a library in the
Now if you attempt to use a class
I've been successful to make this work in VSCode 1.19 but it temporarily stopped working in 1.20 or 1.21 after some refactorings in VSCode. Absolute path imports should be working again VSCode auto-import with absolute paths required some prerequisites in 1.19:
Example
Generating the full package name as a directory structure would also make it easier to compile an application from a monorepo structure. For example you could make webpack resolve
in your webpack config. Then you can compile and bundle libs in the monorepo into an application without having to link them with |
Ideally, the directory should be configurable regardless of the package name Anyway,
|
@gms1 Brocco has answered the reasoning in one of the commit discussions. They drop the As far as I understood instead of a generic path mapping (which would be possible when sticking to package name convention) the CLI will generate a path mapping for each lib in |
@gms1 See here angular/devkit#646 (comment) |
I see the logic made it up but I'm unable to generate a new project with a scope:
Is this as expected for now or should I open a separate issue? This does however function with |
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 xxx
cd
into the new projectng g library @xxx/core
Observed behavior
It throws the following error in the shell:
Could not find an NgModule. Use the skip-import option to skip importing in NgModule.
Desired behavior
It should generate a library named
@xxx/core
in the folderprojects/xxx-core
or maybeprojects/xxx/core
or evenprojects/core
with the correct package name@xxx/core
in the package.json file.If it's not possible, then it should throw an error message that explains that it doesn't support scoped package names.
The text was updated successfully, but these errors were encountered: