Skip to content

Commit a783312

Browse files
committed
support absolute path
1 parent d56c54d commit a783312

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

index.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ async function toSource(input: Options['content'], assets: Compilation['assets']
7676
}
7777

7878
function resolveFilePath(basePath: string, name: Options['name'], hash?: string) {
79-
let parts = typeof name === 'function' ? name(hash) : name
80-
if (!Array.isArray(parts)) {
81-
parts = [parts]
79+
name = typeof name === 'function' ? name(hash) : name
80+
name = Array.isArray(name) ? path.join(...name) : name
81+
if (path.isAbsolute(name)) {
82+
return name
8283
}
83-
return path.relative(basePath, path.resolve(basePath, ...parts))
84+
return path.relative(basePath, path.resolve(basePath, name))
8485
}

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
},
1616
"peerDependencies": {
1717
"webpack": ">= 5"
18+
},
19+
"engines": {
20+
"node": ">= 12"
1821
}
1922
}

0 commit comments

Comments
 (0)