Comments (9)
@jlarmstrongiv could this help? remarkablemark/html-dom-parser#502
from html-react-parser.
After an hour of debugging—I confirmed the answer is overriding the version to the server version. @remarkablemark adding 'html-dom-parser/server'
would be extremely helpful for these use-cases
from html-react-parser.
@jlarmstrongiv would you be interested in improving the README.md?
Since this feels more like an edge case, I think it makes more sense to make custom overrides in the bundler config.
from html-react-parser.
Since this feels more like an edge case, I think it makes more sense to make custom overrides in the bundler config.
Rendering in WinterCG runtimes (Vercel, Cloudflare, and other functions) and web workers are becoming more and more common these days.
I personally prefer adding the export because that will be the same no matter what. Overriding bundlers is often error prone, painful, and bundler-specific, particularly when throwing in esm. Sometimes it may not even be possible. For example, it’s not possible to override just the web worker—it’s all or nothing. Whereas, with imports, I have a lot more flexibility.
If you’re up for adding that export, I’ll gladly update the README.md
from html-react-parser.
Could you clarify what you mean by adding an export? Do you mean this:
import 'html-dom-parser/server';
from html-react-parser.
Yes, like import parse from 'html-dom-parser/server'
. Though, remarkablemark/html-dom-parser#502 brings up a very good point that the server export would need to be propagated to html-react-parser
too
from html-react-parser.
Gotcha that might be a bit tricky to propagate since html-dom-parser
relies on the bundler to figure out if the library uses the server parser or the browser parser.
from html-react-parser.
we are running into this issue with react-rails
pre-rendering, which uses ExecJS/MiniRacer/Node.js to render on the server. but we also render the same components in the browser. for now we're using a polyfill to stub out the document
API to mvp (read: no errors, but no dom either) in the prerendering case, which isn't ideal.
from html-react-parser.
Getting this issue as well with a CloudFlare worker environment and Vite. Would love a fix here.
Adding html-react-parser
to the vite config like below removes the error export is not defined
however I also encounter the poster's error message
ssr: {
optimizeDeps: {
include: [
'html-react-parser',
],
},
},
from html-react-parser.
Related Issues (20)
- Add Current Node Index in `replace` Callback HOT 6
- Replacing domNode with editor element multiple times breaks editor bubble menu HOT 4
- Method transform has wrong current index HOT 5
- Validate props beforing passing the props object to the element HOT 3
- SVG html with large Data URL returns empty SVG code HOT 2
- Importing the lib with a very large size HOT 2
- How to resize/style the HTML content? HOT 11
- important style is not parsed HOT 13
- Resolution error when using TypeScript with `moduleResolution` set to `node16` or `nodenext` HOT 3
- How to keep a specific element from being transformed by React? HOT 2
- Type of `parse` is `any` HOT 2
- Version 5.1.5 - multiple versions of @types/react causes typescript build errors HOT 6
- Incompatible default exports between ESM and CJS HOT 5
- domNode to HTML string? HOT 2
- String text with less than greater than sign are treated as tags. (eg. 4<y<8) HOT 1
- Components outside html component get resized HOT 6
- Next JS Support HOT 3
- Question: Replace node type text by a React Component HOT 2
- Sibling self closing tags become nested HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-react-parser.