We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dfd9b6 commit e595aebCopy full SHA for e595aeb
scripts/rollup/plugin-virtual.mjs
@@ -0,0 +1,14 @@
1
+// Note: this is implemented as a .js + .d.ts, rather than just .js or .ts,
2
+// so we can use it in both JS scripts without compiling and in TS test files
3
+
4
+export default function virtual(code, name = '__virtual__') {
5
+ return {
6
+ resolveId(id) {
7
+ // Don't turn the virtual module into a real file path
8
+ if (id === name) return id;
9
+ },
10
+ load(id) {
11
+ if (id === name) return code;
12
13
+ };
14
+}
0 commit comments