[Bug] Multiple config and broken invalidation right from the start
Describe the bug
When running in watch mode with an array of webpack configs the plugin causes compilation invalidation right from the start.
invalid hook receives null when a string with the fileName is expected.
This behaviour can break other plugins which expect a string for invalid hook.
To Reproduce https://github.com/plesiecki/multiconfig-virtual-modules-repro
Environment if relevant (please complete the following information):
- Node version 18.18.2
- Webpack version 5.89.0
Additional context
- Subsequent calls of the
invalidhook receive a string (e.g. after saving the source fileindex.js). - All good in case of single webpack config.
There is no explanation here what exactly does webpack-virtual-plugin do incorrect, hence this issue is invalid.
Let me emphasize this one more time.
This plugin causes compilation invalidation right from the start in case of exporting multiple configurations from webpack config.
Most importantly, with this plugin on the list the invalid compiler hook receives null in case of initial invalidation.
I've stumbled upon this because that behaviour broke one of the other plugins.
Please don't be afraid to fiddle with repro. It's minimal and simple.
This is the place for issues with the incorrect behavior of this plugin. Please use stack overflow for usage issues. Going to close this issue as won't fix.
Not sure if you're aware but webpack supports multiple config. I've given you an example of incorrect behavior of this plugin. Tell me which part you don't understand, I'm happy to elaborate. I'm ready to setup repro online in case cloning is too much.
I'll understand if you're not going to support multi config setup, but let's get it straight and at least make that statement. It'll be useful for future user to know that they can expect weird behaviour in case of multi config setup.
Not sure if you're aware but webpack supports multiple config.
I know this very well.
I've gave you an example of incorrect behavior of this plugin.
You did not. You gave the example where this plugin is used and it results in unwanted outcome. However there is no clear way to say that the bug is in this plugin, the bug might be in webpack itself, you didn't provide proofs that the bug is in this plugin. The fact that by removing the plugin the bug goes away doesn't prove that the bug is in the plugin.
Tell me which part you don't understand, I'm happy to elaborate.
It's vice versa, I understand what you wrote, the problem is that you don't understand what I wrote.
I'm ready to setup repro online in case cloning is too much.
The repro in github is fine, but I'm not ready to jump into each repro when it is not 100% clear that the there is a bug in my code.
Man, now you're talking! I was thinking the same, the problem might be on webpack side. I wonder, how would you approach answering if this is webpack fault or not?
Man, now you're talking! I was thinking the same, the problem might be on webpack side. I wonder, how would you approach answering if this webpack fault or not?
console.log, I guess, as usual into different places inside node_modules/webpack to figure out why invalidation happens with null.
Reopening as we start finding some understanding. This issue might be tough to investigate though.
Closing as stale, please reopen if you still have interest in this issue