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
Versioning of Angular between Angular Applications and Angular Libraries #43949
Comments
The docs actually make mention of this here where they offer this as a solution, {
"compilerOptions": {
// ...
// paths are relative to `baseUrl` path.
"paths": {
"@angular/*": [
"./node_modules/@angular/*"
]
}
}
} HOWEVER I would still contend this is not a very good error. I'm not sure how this can be fixed as it seems to come from tsc, but it's a pretty bad user experience. |
In terms of compatibility:
We try to ensure that Angular applications can use libraries that are versioned up to 2 major versions prior to the version of the application. (But in practice, you can usually go much further back than that - there are a number of libraries that are built with v8, for example, that work fine with v12 applications). We do not officially support an application using a library that was built with a newer version of Angular than the application. So if your application is built with Angular v11, then all the libraries it depends upon ought to be built with v11 or earlier. This actually also includes minor versions, but not patch versions. (Again, in practice, you may well be able to get away with using a library with a newer version, although v13 has a hard break in this regards since it is not possible to consume v13 libraries with ViewEngine applications). |
But this issue is not really about version skew. Instead it is more about the fact that if you use |
@petebacondarwin I agree though it's great to know that applications support libraries two major versions-back with partial-ivy. That should be published in the docs. It seems like a question that people will often ask (can their Angular library published on npm be used by older version of Angular). Your follow up is exactly the problem. It would just be nice to know if during angular compilation if the problem was a result of Angular-version-mismatch the modifications necessary to the tsconfig to resolve the issue. |
I think the main issues is that @alan-agius4 may have more to say on this. |
I agree with @petebacondarwin, we should definitly remove the One of the many problems with |
The monorepo approach has its own share of problems, not least of which is that it's totally unsupported with tooling (like semantic-release) and also remarkably undocumented.
This is the problem that I found, but this problem can be easily solved with this which worked for us and was documented. Also important to point out, that I can fork an angular-library on GitHub build it and link it in with |
I do agree, that single and multi repos have their own goods and bads. But, because a tool doesn't support mono-repos, doesn't make mono-repos bad. That just makes that tool not the suitable for that architecture. For mono-repos other tools should be considered instead of I personally think that the popularity of mono repos will continue to grow in the coming years, especially now that NPM 7 fully supports workspaces. Previously, this was only possible by using |
We update the `creating libraries` guide to remove View Engine references. This is because in version 13 users are no longer able to build libraries using View Engine. In addition to the above, we also remove references to `npm link`. As this is actually not a recommended workflow, and was mostly needed in older versions of the CLI prior to version 6, were multi-projects workspaces were introduced. Closes #43949 PR Close #43982
This is going to just cause more questions now. I mean anyone writing an angular app that has to fork an angular library will be wondering how they build that angular library and get the code into their app. The assumption that this problem goes away because Angular supports workspaces won't hold true when the library is externally maintained. |
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. |
Description
I'm getting an error when I compile an angular library that uses a different version of Angular than the library it's including.
Please provide the steps to reproduce the issue
Create an Angular application in which your
package.json
hasCreate an Angular library in which your
package.json
hasThen link the application to the library with
ng link
Compile the application with with
ng build
.Please provide the expected behavior vs the actual behavior you encountered
I would prefer to know can an application be versioned newer than a library? Can a library be versioned newer than the application it's compiled in? Or do all Angular things (applications and libraries) need to have the same version?
It would be nice to have a better warning and documentation on this.
Please provide the exception or error you saw
The text was updated successfully, but these errors were encountered: