merlosy / ngx-material-file-input

File input for Angular Material form-field
https://merlosy.github.io/ngx-material-file-input
MIT License
257 stars 63 forks source link

Problem compiling v2.1.1 under Angular 9.1.4: failure in diagnostic #110

Open mfeblowitz opened 2 years ago

mfeblowitz commented 2 years ago

Consistently seeing this:

Compiling ngx-material-file-input : module as esm5

chunk {main} main.js, main.js.map (main) 699 bytes [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 754 bytes [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 525 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 155 kB [initial] [rendered]
Date: 2022-04-21T22:36:08.500Z - Hash: 2c905d6e8f054fb9645f - Time: 11371ms

ERROR in TypeError: Cannot read property 'start' of undefined
    at Object.addParseSpanInfo (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js:54:32)
    at AstTranslator.visitPropertyRead (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/expression.js:202:27)
    at PropertyRead.visit (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler/bundles/compiler.umd.js:7772:28)
    at AstTranslator.translate (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/expression.js:73:24)
    at Object.astToTypescript (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/expression.js:50:27)
    at TcbExpressionTranslator.translate (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:1212:33)
    at tcbExpression (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:1200:27)
    at processAttribute (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:1474:24)
    at Array.forEach (<anonymous>)
    at tcbGetDirectiveInputs (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:1424:19)
    at TcbDirectiveOp.execute (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:342:26)
    at Scope.executeOp (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:975:26)
    at Scope.render (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:888:22)
    at Object.generateTypeCheckBlock (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js:56:37)
    at TypeCheckFile.addTypeCheckBlock (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/type_check_file.js:45:41)
    at TypeCheckContext.addTemplate (/Users/mfeb/spa-newdev3/spa/node_modules/@angular/compiler-cli/src/ngtsc/typecheck/src/context.js:109:36)

The exception can be traced to addParseSpanInfo in @angular/compiler-cli/src/ngtsc/typecheck/src/diagnostics.js and is due to a null span element, from one of the many addParseSpanInfo calls.

Inserting a test for an undefined span bypasses the message above, but it seems there is something missing upstream. Also, not easy to patch, in a complex install inside a docker build.

I have tried lesser and greater versions of nix-material-file-input, but of course that breaks the build. I could try to change the angular/compiler-cli version, but I expect cascading failures.

Also, it seems to take a long time for this component to compile.

Recommendations?