Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
Milestone
Description
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
Yes
Description
We upgraded to 16.2.0 and are getting the following error on build.
Any ideas?
Cannot create property 'message' on string '@angular\common\fesm2022\common.mjs: Unsupported syntax, expected a string literal.
6275 | }
6276 | static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NgOptimizedImage, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
> 6277 | static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: NgOptimizedImage, isStandalone: true, selector: "img[ngSrc]", inputs: { ngSrc: "ngSrc", ngSrcset: "ngSrcset", sizes: "sizes", width: ["width", "width", numberAttribute], height: ["height", "height", numberAttribute], loading: "loading", priority: ["priority", "priority", booleanAttribute], loaderParams: "loaderParams", disableOptimizedSrcset: ["disableOptimizedSrcset", "disableOptimizedSrcset", booleanAttribute], fill: ["fill", "fill", booleanAttribute], src: "src", srcset: "srcset" }, host: { properties: { "style.position": "fill ? \"absolute\" : null", "style.width": "fill ? \"100%\" : null", "style.height": "fill ? \"100%\" : null", "style.inset": "fill ? \"0px\" : null" } }, usesOnChanges: true, ngImport: i0 }); }
6278 | }
6279 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NgOptimizedImage, decorators: [{
6280 | type: Directive,' [plugin angular-compiler]
src/app/app.module.ts:6:25:
6 │ import { DatePipe } from '@angular/common';
╵ ~~~~~~~~~~~~~~~~~
This error came from the "onLoad" callback registered here:
node_modules/@angular-devkit/build-angular/src/builders/browser-esbuild/angular/compiler-plugin.js:247:18:
247 │ build.onLoad({ filter: /\.[cm]?js$/ }, (args) => (0, ...
at setup (@angular-devkit\build-angular\src\builders\browser-esbuild\angular\compiler-plugin.js:247:19)
at async handlePlugins (esbuild\lib\main.js:1326:9)
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 16.2.0
Node: 18.16.0
Package Manager: npm 9.6.7
OS: win32 x64
Angular: 16.2.1
... animations, cdk, common, compiler, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1600.6
@angular-devkit/build-angular 16.0.6
@angular-devkit/core 16.0.6
@angular-devkit/schematics 16.2.0
@angular/cli 16.2.0
@angular/compiler-cli 16.0.6
@schematics/angular 16.2.0
rxjs 7.8.1
typescript 4.9.3
zone.js 0.13.1
Anything else?
No response

Activity
JoostK commentedon Aug 17, 2023
The problem here is the usage of
@angular/compiler-cli16.0, whereas the other Angular dependencies are 16.2. This is not supported and you should have received peer dependency warnings duringnpm install.We should have bumped the
minVersionwhen adding the transform function to the inputs array in the partial declaration. Once that is present, older versions of the Angular compiler are no longer capable of consuming libraries that have been compiled with newer versions of Angular.JoostK commentedon Aug 17, 2023
I am going to put up a PR to increase the
minVersionto report a more meaningful error in the future, but this particular instance cannot be fixed; you'll have to align your version of@angular/compiler-cliwith the rest of the Angular framework packages.psarno commentedon Aug 17, 2023
Thank you @JoostK ... I'm getting twisted because I have to deal with PrimeNG moving to 16.2.1 and have to untangle all of these dependencies and sub-dependencies betwee what they want/need, what I don't want and need.
It's like the new version of "DLL hell". 👍
fix(compiler-cli): enforce a minimum version to be used when a librar…
fix(compiler-cli): enforce a minimum version to be used when a librar…
fix(compiler-cli): enforce a minimum version to be used when a librar…
ssams commentedon Sep 11, 2023
Just stumbled across this via the Changelog, so if I read this correctly it means that there can be situations where a library compiled with X.1 may not be compatible with release X.0? Either this shouldn't be the case and this was an accidental breaking change, or the documentation is quite misleading: https://angular.io/guide/creating-libraries#ensuring-library-version-compatibility -> no mention of minor releases, I'd expect that any library compiled with some 16.z release to work with projects using all 16.y versions.
JoostK commentedon Sep 11, 2023
We try to maintain forwards compatibility for minor versions, but there is no hard guarantee. This particular example shows why: adopting features that have become available in a newer minor cannot be used in an older minor, so using that older minor would then not be possible.
ssams commentedon Sep 11, 2023
but in #50714 (review) by @pkozlowski-opensource
?
Also, when creating a project with a separate lib as in https://angular.io/guide/creating-libraries#getting-started, a setup with e.g.
^16.2.0in both the package.json of the application, and also in the peer dependencies of the library is created. This would allow 16.3 to be used in the project, and thus also for the packager, however then one would need to update the peer dependencies to 16.3 too manually. Without knowing which minimum version the tooling will select internally, it's quite hard to set the correct peer dependency version without being overly strict. I don't think it would be problematic per se if one knows what to expect, but right know there seems to be contradicting or at least very confusing information around in the comments and documentation regarding handling of major and minor versions.btw, I suppose we should split this into a separate issue if it's further ongoing, to avoid hijacking this one for a new discussion?
angular-automatic-lock-bot commentedon Oct 12, 2023
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
fix(compiler-cli): enforce a minimum version to be used when a librar…