1
1
import type { AstroConfig , AstroIntegrationLogger } from "astro" ;
2
+ import { createHash } from "node:crypto" ;
3
+ import { parse , resolve } from "node:path" ;
2
4
import { mkdir , readFile , writeFile } from "node:fs/promises" ;
3
5
import type { Plugin } from "vite" ;
4
6
import type {
@@ -8,8 +10,6 @@ import type {
8
10
} from "../typings/integration" ;
9
11
import loadLocalCollection from "./loaders/loadLocalCollection.js" ;
10
12
import loadIconifyCollections from "./loaders/loadIconifyCollections.js" ;
11
- import { createHash } from "node:crypto" ;
12
- import Path from "node:path" ;
13
13
14
14
interface PluginContext extends Pick < AstroConfig , "root" | "output" > {
15
15
logger : AstroIntegrationLogger ;
@@ -51,8 +51,8 @@ export function createPlugin(
51
51
configureServer ( { watcher, moduleGraph } ) {
52
52
watcher . add ( `${ iconDir } /**/*.svg` ) ;
53
53
watcher . on ( "all" , async ( _ , filepath : string ) => {
54
- const parsedPath = Path . parse ( filepath ) ;
55
- const resolvedIconDir = Path . resolve ( root . pathname , iconDir ) ;
54
+ const parsedPath = parse ( filepath ) ;
55
+ const resolvedIconDir = resolve ( root . pathname , iconDir ) ;
56
56
const isSvgFileInIconDir =
57
57
parsedPath . dir . startsWith ( resolvedIconDir ) &&
58
58
parsedPath . ext === ".svg" ;
0 commit comments