Bumping to 0.16.0 - ReferenceError: TextEncoder is not defined
See original GitHub issueWhen installing - "isomorphic-dompurify": "^0.16.0"
I get the following error within a jest test that previously passed.
Error: ReferenceError: TextEncoder is not defined
js file:
import DOMPurify from "isomorphic-dompurify";
return DOMPurify.sanitize(input.trim(), { ADD_ATTR: ["target"] });
Test:
import sanitize from "./sanitizeHtml";
describe("sanitize", () => {
it("remove js from input", () => {
expect(sanitize("<img onload='alert(1)' />")).toEqual("<img>");
});
});
Any ideas what this may be? Thanks in advance
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:20 (10 by maintainers)
Top Results From Across the Web
ReferenceError: TextEncoder is not defined - Stack Overflow
This issue occurs in node 10 or lower version only. To resolve this issue upgrade node version to 12 or higher and then...
Read more >TextEncoder is not defined | NodeJs | MongoDB | Solved
TextEncoder is not definedReference ErrorPath for required filenode_modules/whatwg-url/encoding.jsThanks# TextEncoder #mongodb #nodejs.
Read more >How to Fix : TextEncoder is not defined - MongoDB - YouTube
Node.js #Node.js Version #solved # ReferenceError #howtoBy watching this video you will get a solution of most common node.js code deployment ...
Read more >liquid-fire - UNPKG
_require = undefined;\n }\n\n\n Module.prototype.makeRequire = function() {\n var name = this.name;\n\n return this._require || (this.
Read more >All Problems Tagged With Whatever - Code Grepper
... main.js:1 uncaught referenceerror: timelinemax is not defined · npm warn no repository field · java.lang.nullpointerexception: attempt to invoke virtual ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone hitting this same issue, I was able to fix this on a project (which had a failing test due to this error) by including the following in my
jest.setup.js
file:I installed and I’m facing a similar issue. Everything seems fine.
I tried to print the process version using
console.log(process.version)
and it’s14.7.0
, still giving an error.What is the right solution?
Node version:
14.7.0