webpack-virtual-modules icon indicating copy to clipboard operation
webpack-virtual-modules copied to clipboard

[Bug] Multiple config and broken invalidation right from the start

Open plesiecki opened this issue 2 years ago • 9 comments

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 invalid hook receive a string (e.g. after saving the source file index.js).
  • All good in case of single webpack config.

plesiecki avatar Nov 01 '23 18:11 plesiecki

There is no explanation here what exactly does webpack-virtual-plugin do incorrect, hence this issue is invalid.

larixer avatar Nov 02 '23 14:11 larixer

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.

plesiecki avatar Nov 02 '23 15:11 plesiecki

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.

larixer avatar Nov 02 '23 16:11 larixer

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.

plesiecki avatar Nov 02 '23 17:11 plesiecki

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.

plesiecki avatar Nov 02 '23 17:11 plesiecki

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.

larixer avatar Nov 02 '23 17:11 larixer

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?

plesiecki avatar Nov 02 '23 17:11 plesiecki

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.

larixer avatar Nov 02 '23 17:11 larixer

Reopening as we start finding some understanding. This issue might be tough to investigate though.

larixer avatar Nov 02 '23 17:11 larixer

Closing as stale, please reopen if you still have interest in this issue

larixer avatar Mar 22 '24 10:03 larixer