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

[Feature] Custom URI scheme

Open Tobbe opened this issue 2 years ago • 0 comments

  • [ ] I'd be willing to implement this feature

Describe the user story

I'd like to namespace all my virtual modules under a separate URI scheme. To make it clear that they are virtual modules and not just regular packages.

Describe the solution you'd like

Something like virtual:myModule. Used like import foo from 'virtual:myModule'

Describe the drawbacks of your solution

I guess the biggest drawback is extra complexity in the plugin source code.

Describe alternatives you've considered

I'm doing virtual-myModule for now. But that is still something a regular module could be called. So it's not exactly as clear as I'd want it to be.

Additional context

Heavily inspired by Vite's conventions: https://vitejs.dev/guide/api-plugin#virtual-modules-convention

Tobbe avatar Dec 20 '23 20:12 Tobbe