You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using html-react-parser in Webworkers, window and document are not defined. You mentioned that it works also on Nodejs where window and dom are also not defined. How would one work around this.Thanks
The text was updated successfully, but these errors were encountered:
The reason html-react-parser can be used in Node.js and in the browser is because of the dependency html-dom-parser, which is used to parse HTML string to DOM nodes.
In Node.js, html-dom-parser relies on htmlparser2; in the browser, html-dom-parser relies on the native browser API.
This is done to keep the bundle size small for the client. This is crucial because there is a direct correlation between bundle size and the time it takes to load it (as well as the cost it takes to serve it).
Now if you really wanted to include htmlparser2 in the html-dom-parser build, you'll need to remove the "browser" field and rebuild your bundle with webpack (or any other module bundler).
Otherwise, there should be other HTML to React parsers that can satisfy your needs.
When using html-react-parser in Webworkers, window and document are not defined. You mentioned that it works also on Nodejs where window and dom are also not defined. How would one work around this.Thanks
The text was updated successfully, but these errors were encountered: