-
Notifications
You must be signed in to change notification settings - Fork 198
filter by descriptionData
#456
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
Comments
In theory it is possible to support this, but I don't rank this high on the list of priorities for
The In the meantime you could workaround this by using capture groups in RegExp to specify a few modules I believe: for example, set |
ok. Looking forward for support, when you get to it. I meant - what if I don't filter at all with the plugin? does it apply additional processing to the files, or increase bundling time? Since I'm already using module: {
rules: [
{
test: /\.js$/,
include: path.join(workDir, 'node_modules'),
descriptionData: { componentId: ComponentID.isValidObject },
// and other filtering logic
use: [
{
loader: require.resolve('babel-loader'),
options: {
plugins: [ require.resolve('react-refresh/babel') ],
babelrc: false, configFile: false, compact: false, minified: false
},
},
],
}
]
},
plugins: [
new ReactRefreshWebpackPlugin({
include: componentsDirs,
exclude: /exclude_nothing_at_all/i,
}),
] For the workaround - I used |
I'm seeing more usecases where it is needed. In the example above, we used I can't add the file suffix rule into the include, so I have to do something like this: 😥
I will try to find something else |
I'm starting to work on improving this, expect it to be in the next patch release 😄 |
amazing! and it will support the same structure as a Webpack 5 rule? |
Yes, hopefully it is possible |
👀 |
I've been trying to make this work, but unfortunately it is not as simple as it sounds. The compiler for rules which Webpack use is not exposed for third parties, so to emulate their behaviour would mean we have to re-implement the whole thing. Instead of going down this route, it is possible for you to opt out of the built-in integration of the loader by making the |
cool. I will try it out! And I still need to include the babel loader, right? Actually it makes more sense, in an inversion of control kind of way - it is clearer what gets included, and has less "black magic". I'll dig a little in the source code, but do document it! |
Yes, you still need the Babel loader. |
it works like a charm! The options I see are |
I'll report if I run into problems.. |
I still believe that the batteries-included and minimal configuration would be best, so the default of auto-injection seems to still make sense. However, it would be nice to add a section in the troubleshooting docs where this setup is documented.
Yea, they will be there soon. |
- use fast refresh loader explicitly, with the existing Webpack heuristics! Thanks to pmmmwh/react-refresh-webpack-plugin#456 - remove hacks trying to set which packages / components should be included by the plugin.
I'm getting the same error message:
This is the code:
Other Info:
|
You have to make sure your JSX is transformed by your Webpack config. This error shows that your loader chain only includes this plugin but not anything else that would transform JSX into JS which is what Webpack needs to work with. |
I need more granular filtering, using the
descriptionData
rule available in Webpack5. (We have some packages in the node_modules that need reloading)I see only
exclude
andinclude
. Is support for the entire Webpack condition object coming?And is it important to filter files for the
ReactRefreshWebpackPlugin
? or rule forreact-refresh/babel
enough?The text was updated successfully, but these errors were encountered: