-
Notifications
You must be signed in to change notification settings - Fork 194
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
Setting exclude / include options to the plugin is required when I have module.rules.exclude are required? This is not working with a type of regex #324
Comments
Hi, can you give a bit more information on how your Webpack config look like? If you use Apart from that, your regex doesn't see to do what you want - I am assuming you want to exclude everything under You test with the following cases:
I think you would want this instead - |
Hi! thank you for your response! Apart of the regex test target, I don't understand why if I use webpack.config.js
|
I've identified a bug, this would be fixed in the next release. |
@pmmmwh I got this same error just now on 0.10.0. I expect that the intention of @rocalvo-meli's regex was "exclude everything in this is a common requirement in monorepo setups, where you are actively modifying the source code of another package that you read via a symlink in node_modules. in fact, Jest has a section on their docs to explain this exact path matching problem: @rocalvo-meli's regex actually looks fine, but will go bang on Windows because paths are separated by backslashes. you can support all platforms by changing the regex like so (this got fast-refresh working in my monorepo): exclude: /node_modules[/\\](?!frontend-lazy)[/\\]/, otherwise, the matcher will end up excluding nothing (because it insists that files need certain forwardslashes in order to be excluded, and a Windows filepath would have no forwardslashes). with no files excluded: the webpack plugin attempts to inject itself into everything, including some files which are not targeted by the ProvidePlugin. those files have had no definition of |
Are you using
It has nothing to do with Windows - the RegExp was problematic as it didn;t include any actual match-able characters within the two slashes, so essentially it only match
The issue with no files excluded actually would yield recursive dependencies - React Refresh Utils would try to inject itself into itself. This is now avoided since we explicitly blacklist things related to that. |
Hi! 👋 😄
Is this option exclude required when I have
module.rules.exclude
inside mywebpack.config.js
?I'm trying to set the exclude option in the follow format and is not working:
I also try with the following format and didn't work:
exclude: /\/node_modules\/(?!frontend-lazy)\//
That is the format that I use inside my
module.rules.exclude
The error that I see on the browser console is:
Thank you in advance! 🙏 😊
The text was updated successfully, but these errors were encountered: