Pravesh Shetty
Pravesh Shetty

Reputation: 114

Not able to use DOMPurify.sanitize in angular application, when imported as an ES6 module

I'm trying to use dompurify in my angular application, where in a service. I'm importing it as

import * as DOMPurify from 'dompurify';

This works fine when run normally as a CSR application. But if I run it as a SSR, I get

export 'sanitize' (imported as 'DOMPurify') was not found in 'dompurify' (possible exports: default)

I'm using dompurify v3.0.3. On the other hand, If I use

const DOMPurify = require('dompurify')

It works without an error . But I'm not sure if this is the correct way to use it as angular recommends using ES6 imports.

Upvotes: 1

Views: 2448

Answers (0)

Related Questions