Replies: 16 comments
|
Thanks for opening this issue @robmaas! Do you have a suggestion on what the fix would be? |
|
@remarkablemark not really, I'm not very familiar with ES exports etc. |
|
@robmaas Thanks for the update! I'll also try to see if I can reproduce this locally in my spare time. |
|
I encountered a Probably similar issue: |
|
@MaxTwentythree That's probably an unrelated other issue. My original problem also occurs on |
|
@MaxTwentythree Sorry for the delayed response, been very busy lately. |
|
@robmaas: same :) |
|
@MaxTwentythree can you provide a reproducible example? |
|
Hi @remarkablemark, the issue is definitely related the When removing the I think this is somewhat related, because we do use |
|
@robmaas Thanks for the update. Unfortunately, I can't remove |
|
@remarkablemark Obviously, just reporting that it is related. Been struggling a bit to isolate the issue to a reproducible project, but will try again sometime soon (not really a big priority at the moment). |
|
@remarkablemark Finally got it. Turns out we have some webpack loader configuration with patterns that incorrectly match for For example: {
// anything in node_modules that isn't js,
// we load as null - e.g. imported css from a module,
// that is not needed for SSR
test: /\.(?!js|html$)[^.]+$/,
include: /node_modules/,
use: {
loader: 'null-loader'
}
}This pattern allows Before #434 our solution used the exported Updating the regex to include ReproFilename: {
"name": "html-react-parser-repo-1071",
"private": true,
"version": "1.0.0",
"type": "module",
"dependencies": {
"html-react-parser": "1.4.6",
"null-loader": "4.0.1",
"webpack": "5.76.1",
"webpack-cli": "5.0.1"
},
"scripts": {
"build": "webpack --config webpack.config.cjs",
"start": "cd src && node index"
}
}Filename: module.exports = {
mode: 'development',
resolve: {
mainFields: ['main', 'module']
},
module: {
rules: [
{
test: /\.(?!js|html$)[^.]+$/,
include: /node_modules/,
use: {
loader: 'null-loader',
}
}
]
}
};Filename: import parse from 'html-react-parser';
console.log('parsed: ' + parse('<p>test</p>'));Output |
|
Amazing @robmaas, thanks for the reproduction! If you'd like, feel free to open a PR to improve the README.md. Otherwise, I can close this issue and convert it to a discussion. |
|
Hi @robmaas , |
Thats ok, it isn't really related to this repo after all so feels a bit much to add it to the FAQ. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The workaround for Webpack warnings described in the
REAMDE.mdno longer seems to be working for projects usinghtml-react-parserversion1.4.6and later.(described in #213 )
We use the workaround in our webpack.config:
When upgrading the
html-react-parserpackage from1.4.5to1.4.6the same error comes up again:I guess it is caused by the
index.mjsexport change in 03bb4d9This issue persist up to the latest version
4.2.2.Expected Behavior
Build completes succesfully.
Actual Behavior
Webpack builds fails with an error.
Steps to Reproduce
Reproducible Demo
Our project is very complex, it is not very easy to create a repro. If that is necessary I'll see what I can do.
Environment
5.88.2Keywords
All reactions