rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Bug]: rspack.experiments.VirtualModulePlugin would cause a removed module log

Open SoonIter opened this issue 5 months ago • 4 comments

System Info

@rspack/core 1.5.4 1.5.5

Details

 chain
        .plugin('rsbuild-plugin-virtual-module')
        .use(rspack.experiments.VirtualModulesPlugin, [
          {
            './src/virtual-json-list.js': '11;',
          },
        ]);
Image

Reproduce link

https://github.com/rspack-contrib/rsbuild-plugin-virtual-module/tree/syt/virtual-module-issue

Reproduce Steps

  1. git clone https://github.com/rspack-contrib/rsbuild-plugin-virtual-module.git

  2. git checkout syt/virtual-module-issue

  3. cd ./playground

  4. npm run dev

SoonIter avatar Sep 17 '25 07:09 SoonIter

Update: This also resulted in an unnecessary rebuild

chenjiahan avatar Sep 25 '25 02:09 chenjiahan

This happens because Watcher is trying to watch virtual files, but they don't exist, so Watcher will always return file removed. It's easy to ignore them in Watcher, but I doubt if it's right to impl it as webpack would rebuild too.

Austaras avatar Sep 26 '25 03:09 Austaras

since it's actually a watchpack issue(which doesn't support custom fs) we can only fix it in native-watcher(which should support inputfs)

hardfist avatar Oct 13 '25 03:10 hardfist

Please refrain from using VirtualModulesPlugin for now if you find the log annoying. I'm planning to do a full refactor on the native watcher to support custom FileSystem.

h-a-n-a avatar Oct 27 '25 08:10 h-a-n-a