Reputation: 1783
I have an angular project uses "node": "14.17.3". Not sure what changed but all of a sudden I have an issue with dompurify 3.0.5.
Error: export 'sanitize' (imported as 'DOMPurify') was not found in 'dompurify' (possible exports: default)
So what I did was
"allowSyntheticDefaultImports": true in tsconfig.json
and
import it as >> import { default as DOMPurify } from 'dompurify';
and
added @types/dompurify: ^3.0.2 in package.json
But now I got this issue
dompurify/dist/purify.cjs.d.ts:401:1 - error TS2309: An export assignment cannot be used in a module with other exported elements. 401 export = _default;
So I'm forcing it to import it as
import { default as DOMPurify } from 'dompurify/dist/purify.es.mjs';
But not I got this error
Module not found: Error: Package path ./dist/purify.es.mjs is not exported from package ..\node_modules\dompurify (see exports field in ..\node_modules\dompurify\package.json)
Any idea how to resolve it? thank you!
Upvotes: 0
Views: 168