Angular Library Compile Time Error "Invariant violated: No format-path or format"

886 views Asked by At

I have an Angular 11 project that is trying to integrate SpreadJS Designer, but is failing during the ngcc step Compiling @grapecity/spread-sheets-designer-angular : esm2015 as esm2015 with the exception:

Error on worker #3: Error: Invariant violated: No format-path or format for /path/to/my/project/node_modules/@grapecity/spread-sheets-designer-angular : main (formatPath: bundles/grapecity-spread-sheets-designer-angular.umd.js | format: undefined)

How do I further diagnose and fix this problem?

Here is the output of npx ng version for my project:

Angular CLI: 11.0.2
Node: 14.15.1
OS: linux x64

Angular: 11.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.2
@angular-devkit/build-angular   0.1100.2
@angular-devkit/core            11.0.2
@angular-devkit/schematics      11.0.2
@angular/cdk                    11.0.1
@angular/material               11.0.1
@schematics/angular             11.0.2
@schematics/update              0.1100.2
rxjs                            6.5.3
typescript                      4.0.5

Then rm -rf node_modules && npm install; npm ls | grep grapecity gives this output:

├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├── @grapecity/[email protected]
├─┬ @grapecity/[email protected]
│ ├── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├── @grapecity/[email protected]
├─┬ @grapecity/[email protected]
├── @grapecity/[email protected]
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ ├── @grapecity/[email protected] deduped
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected]
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
├─┬ @grapecity/[email protected]
│ └── @grapecity/[email protected] deduped
1

There are 1 answers

0
ricardoaleixoo On

I had some problems with SpreadJS + Designer following their poor examples .. anyway. what helped me was:

import { DomSanitizer } from '@angular/platform-browser'

.
.
.

title: 'Tabela customizável',
designer: null,
props: {
 styleInfo: **this.sanitizer.bypassSecurityTrustStyle**('width: 100%; height: calc(100vh - 300px)'),
 config: this.spreadMenuConfig,
},