Open tmg0 opened 1 month ago
I have created a demo for this issue, it works well on stackblitz and unix like platform:
/__virtual/1
/__virtual/2
asset main.js 5.11 KiB [compared for emit] (name: main)
runtime modules 670 bytes 3 modules
cacheable modules 139 bytes
./src/index.js 83 bytes [built] [code generated]
./_virtual_%2F__virtual%2F1 28 bytes [built] [code generated]
./_virtual_%2F__virtual%2F2 28 bytes [built] [code generated]
webpack 5.94.0 compiled successfully in 305 ms
But on windows, it was broken:
\__virtual\1
\__virtual\2
C:\webpack-webpack-js-org-fy87xb\plugin\virtual.js:20
throw new Error(`Unexpected id: ${id}`)
^
Error: Unexpected id: \__virtual\1
at Object.load (C:\webpack-webpack-js-org-fy87xb\plugin\virtual.js:20:15)
at Object.load (C:\webpack-webpack-js-org-fy87xb\node_modules\.pnpm\unplugin-doctor@0.1.1\node_modules\unplugin-doctor\dist\index.cjs:5:524)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.load (C:\webpack-webpack-js-org-fy87xb\node_modules\.pnpm\unplugin@1.14.1\node_modules\unplugin\dist\webpack\loaders\load.js:130:15)
Environment
Reproduction
https://github.com/tmg0/unplugin
Describe the bug
When I try to load a virtual module with
/
prefix on windows, id path has been converted from/
to\
, and this issue causedunplugin-vue-router
doesn't work with rspack and webpackI have forked this repo and modify the test file in
virtual-module
Additional context
No response
Logs