Replies: 16 comments
-
Thanks for opening this issue @robmaas! Do you have a suggestion on what the fix would be? |
Beta Was this translation helpful? Give feedback.
-
@remarkablemark not really, I'm not very familiar with ES exports etc. |
Beta Was this translation helpful? Give feedback.
-
@robmaas Thanks for the update! I'll also try to see if I can reproduce this locally in my spare time. |
Beta Was this translation helpful? Give feedback.
-
I encountered a Probably similar issue: |
Beta Was this translation helpful? Give feedback.
-
@MaxTwentythree That's probably an unrelated other issue. My original problem also occurs on |
Beta Was this translation helpful? Give feedback.
-
@MaxTwentythree Sorry for the delayed response, been very busy lately. |
Beta Was this translation helpful? Give feedback.
-
All good @robmaas, thanks for the update |
Beta Was this translation helpful? Give feedback.
-
@robmaas: same :) |
Beta Was this translation helpful? Give feedback.
-
@MaxTwentythree can you provide a reproducible example? |
Beta Was this translation helpful? Give feedback.
-
Hi @remarkablemark, the issue is definitely related the When removing the I think this is somewhat related, because we do use |
Beta Was this translation helpful? Give feedback.
-
@robmaas Thanks for the update. Unfortunately, I can't remove |
Beta Was this translation helpful? Give feedback.
-
@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). |
Beta Was this translation helpful? Give feedback.
-
@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
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Hi @robmaas , |
Beta Was this translation helpful? Give feedback.
-
Thats ok, it isn't really related to this repo after all so feels a bit much to add it to the FAQ. |
Beta Was this translation helpful? Give feedback.
-
The workaround for Webpack warnings described in the
REAMDE.md
no longer seems to be working for projects usinghtml-react-parser
version1.4.6
and later.(described in #213 )
We use the workaround in our webpack.config:
When upgrading the
html-react-parser
package from1.4.5
to1.4.6
the same error comes up again:I guess it is caused by the
index.mjs
export 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.2
Keywords
Beta Was this translation helpful? Give feedback.
All reactions