cant build due to "Optional chaining cannot appear in left-hand side"
See original GitHub issueType of Issue
[ x] Bug Report
Description
After running ng build my-publishable-module
I get an error durring build
✔ Compiling with Angular sources in Ivy partial compilation mode. ✖ Generating FESM2020 Optional chaining cannot appear in left-hand side (Note that you need plugins to import files that are not JavaScript) Error: Optional chaining cannot appear in left-hand side (Note that you need plugins to import files that are not JavaScript) at error (/Users/omar/Sites/met-libs-nx/node_modules/ng-packagr/node_modules/rollup/dist/shared/rollup.js:159:30)
It looks like @rollup@2.68.0
(/ng-packagr/node_modules/rollup/
) throws this error.
There is a lot of chatter about this bug on rollup. but i have not found a solution. https://github.com/rollup/rollup/pull/3582
I tried all the suggestions with rollup and updating it within my project but no luck.
Version Information
Angular CLI: 13.1.3
Node: 14.16.0
Package Manager: npm 6.14.11
OS: darwin x64
Angular: 13.1.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1301.3
@angular-devkit/build-angular 13.1.3
@angular-devkit/core 13.2.5
@angular-devkit/schematics 13.2.5
@angular/cli 13.1.3
@angular/fire 7.2.1
@schematics/angular 13.2.5
ng-packagr 13.1.3
rxjs 6.6.7
typescript 4.5.4
Please include all version numbers that might be relevant, e.g. third-party libraries
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I believe the problem is caused by the below and since you are using casting you are also bypassing Typescript error reporting.
Printing the
fileInfo
on error https://github.com/rollup/rollup/blob/51cab92373bcf8c844a8de2a6765869f7eb05a5d/src/Module.ts#L836 should give should be enough to determine which file is causing the problem.