-
Notifications
You must be signed in to change notification settings - Fork 12k
Libraries can't import stuff from one another (official solution needed) #12453
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
This will cause a circular dependency which will cause the error. As you will have something like: Apart from that, there shouldn't be the need to add any mappings in the "paths": {
"@internal/core": [
"dist/internal/core"
],
"@internal/core/*": [
"dist/internal/core/*"
],
"@internal/types": [
"dist/internal/types"
],
"@internal/types/*": [
"dist/internal/types/*"
]
} |
@alan-agius4 That would explain why Is this really correct the desired behaviour? If |
At the moment circular dependencies are not supported. And is not something that we are planning to do anytime soon. We encourage building application and libraries following the acyclic and not circular dependencies principe. What I suggest is to re-visit your architecture and structure and plan your packages to avoid having circular dependencies as in a mono repo / workspace is not ideal as even just to build a dependency graph it will be kinda messy apart from that this would require to be done by a number of parties as at the moment some other tools don't support circular dependencies. |
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. |
Uh oh!
There was an error while loading. Please reload this page.
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Node: v8.12.0
npm: 6.4.1
ng:
@angular-devkit/architect 0.8.4
@angular-devkit/build-angular 0.8.4
@angular-devkit/build-ng-packagr 0.8.4
@angular-devkit/build-optimizer 0.8.4
@angular-devkit/build-webpack 0.8.4
@angular-devkit/core 0.8.4
@angular-devkit/schematics 0.8.4
@angular/cli 6.2.4
@ngtools/json-schema 1.1.0
@ngtools/webpack 6.2.4
@schematics/angular 0.8.4
@schematics/update 0.8.4
ng-packagr 4.2.0
rxjs 6.2.2
typescript 2.9.2
webpack 4.20.2
Repro steps
ng new my-app
ng generate library @internal/core
ng generate library @internal/types
@internal/core
into@internal/types
and vice versa.ng build @internal/types
orng build @internal/core
The log given by the failure
Desired functionality
It should automatically build both projects without manually having to add a bunch of hacks.
Mention any other details that might be useful
I've gone through every issue regarding this issue but nothing helps, I keep getting the same error.
#10444
#10615
#10780
Are some of the issues I've looked at.
They talk about using
paths
incompilerOptions
in each lib'stsconfig.lib.json
file, I've done this:@internal/core:
@internal/types:
But when I build.. it's like I've done nothing at all.
I'm not sure if this happens mostly because none of the libraries have been built so when you're trying to import something it's not actually there, if so this sounds like a bug to me. If it finds a dependency that's not yet been built it should build it.
Can the official solution please be added somewhere on how you get scoped libraries to work with one another, preferably in the story? https://github.com/angular/angular-cli/wiki/stories-create-library
I'm completely stuck on this and I don't know what to do unless I get proper help here. Please help.
The text was updated successfully, but these errors were encountered: