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
Backwards compatibility with previous versions #46398
Comments
What you describe is not backwards compatibility but forward compatibility. That is, you're asking if Angular 12 can/should support dependencies from applications on libraries that were built with a future version of Angular (e.g. v14). For backwards compatibility, our general policy is to support the previous 2 major versions. v14 Angular projects should be able to depend on v12 libraries, for example. In practice, often libraries will work for longer than this. Angular's forward compatibility is defined by how semantic versioning works, and the restriction is actually pretty strong: forward compatibility only extends to future patch releases. Minor releases may contain new features which break forward compatibility. For example, suppose Angular introduces a new component In practice, forward compatibility will vary. If the library doesn't make use of the new mode, maybe it'll work just fine with 14.0. Many libraries may choose to omit any peer dependency restrictions for that reason, or may simply not be aware of the case for including one in the first place. |
Thanks for clarification and yes you are right it's about forward compatibility 🙂 So in theory if a library does not use any of the new features that were introduced in later versions of Angular it should be possible to use it in older versions? Because this is exactly the case in the library that I'm maintaining and I specifically built a compatibility code for Angular 12 runtime however the app compiler throws an error during the build stating that the library is built for v14 and is not supported. I've noticed in the error that a library compiler generates code that mentions minimum version like So I wonder if there is any way to instruct the compiler that my library may be used with Angular 12? Or just getting an understanding how this metadata is derived would also be good as I've seen some parts were having v12 as minimum version and other v14 in the same codebase. Thanks! |
Indeed, the output for libraries contains the exact version which was used during compilation, as well as a minimum target version. This was baked in from the start of v12 (the initial availability of Ivy's library output) to allow detecting libraries that require a later version at application build time. In v14, the library output has changed for components to support standalone components. In particular, the initial format had separate arrays for the components, directives and pipes that were used in the template. In v14, these were combined into a single
This is not possible and won't be supported, as there's loads of potential forwards compatibility hazards as Alex mentioned; you'll have to build with the version that you want to support as a minimum. |
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. |
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
Hi, I want to apologize in advance if this is not a place for this type of request/discussion.
Basically I would like to understand on official position of Angular framework on backwards compatibility with previous versions, especially in the context of libraries that are built using latest Angular compiler and then are used in an older Angular application.
Previously this was not a problem (it was possible to use library built with Angular v13 inside of an Angular v12 app) but with the release of Angular v14 a library built with it is no longer compiles within Angular v12 app (see the error here) even when the library works fine inside of the storybook environment.
Hence comes the question is this a regression or expected behavior "by design" as I could not find any resources that elaborate on this topic.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response
The text was updated successfully, but these errors were encountered: