fix: always allow './' and '../' to be relative, even on windows

This commit is contained in:
Harttle
2021-11-06 03:36:39 +08:00
committed by Harttle
parent 3d71d9e35a
commit 44f6b520d5
+1 -1
View File
@@ -25,7 +25,7 @@ export class Loader {
if (options.relativeReference) {
const sep = options.fs.sep
assert(sep, '`fs.sep` is required for relative reference')
const rRelativePath = new RegExp(['.' + sep, '..' + sep].map(prefix => escapeRegex(prefix)).join('|'))
const rRelativePath = new RegExp(['.' + sep, '..' + sep, './', '../'].map(prefix => escapeRegex(prefix)).join('|'))
this.shouldLoadRelative = (referencedFile: string) => rRelativePath.test(referencedFile)
} else {
this.shouldLoadRelative = (referencedFile: string) => false