Skip to content

Commit

Permalink
added replace-path-picomatch :3
Browse files Browse the repository at this point in the history
  • Loading branch information
exrem committed Dec 4, 2024
1 parent 21178f2 commit d5b087d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/.vitepress/replace-path-picomatch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import type { Plugin } from 'vite';
export function replacePathPicomatch(): Plugin {
return {
enforce: 'pre',
load(id) {
if (id === 'picomatch') {
return 'export default {}';
}
},
name: 'replace-picomatch',
resolveId(source) {
if (source === 'picomatch') {
return { id: 'picomatch' };
}
if (source === 'path') {
return path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
'../../browser/src/path.ts'
);
}
}
};
}

0 comments on commit d5b087d

Please sign in to comment.