Reputation: 11
I am using Angular 17 and while running the build I am getting an error stating
Error: src/app/common/util.ts:3:8 - error TS1259: Module '"/usr/src/app/node_modules/dompurify/dist/purify.cjs"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
3 import DOMPurify from 'dompurify';
~~~~~~~~~
node_modules/dompurify/dist/purify.cjs.d.ts:437:1
437 export = _default;
~~~~~~~~~~~~~~~~~~
This module is declared with 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.
I tried adding and updating the dompurify version from 3.1.0 to 3.1.7 and added below in tsconfig.json
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strictPropertyInitialization": false
in the angularCompilerOptions
in tsconfig.json but this also did not help instead it started giving
Error: src/app/common/util.ts:126:56 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
In my local machine it is working fine but when I am running and building the code it is failing.
Upvotes: 0
Views: 30