-
-
Notifications
You must be signed in to change notification settings - Fork 132
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack workaround no longer working from 1.4.6 #1071
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. |
All good @robmaas, thanks for the update |
@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. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
The text was updated successfully, but these errors were encountered: