From 44f6b520d53ba984ecb5fc430d70f698837d1802 Mon Sep 17 00:00:00 2001 From: Harttle Date: Sat, 6 Nov 2021 03:36:39 +0800 Subject: [PATCH] fix: always allow './' and '../' to be relative, even on windows --- src/fs/loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fs/loader.ts b/src/fs/loader.ts index 908844a5f5..430c1aaeff 100644 --- a/src/fs/loader.ts +++ b/src/fs/loader.ts @@ -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