Skip to content

Commit c65a9be

Browse files
committed
Check for relative paths on windows
1 parent 58fb417 commit c65a9be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugin/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ export const visualizer = (
290290
});
291291

292292
if (opts.emitFile) {
293-
if (path.isAbsolute(filename) || filename.startsWith("./") || filename.startsWith("../")) {
293+
// Regex checks for filenames starting with `./`, `../`, `.\` or `..\`
294+
// to account for windows-style path separators
295+
if (path.isAbsolute(filename) || /^\.{1,2}[/\\]/.test(filename)) {
294296
this.error(ERR_FILENAME_EMIT);
295297
}
296298
this.emitFile({

0 commit comments

Comments
 (0)