From c2387f044485a51bfed6e9ab8408fd0c3204ea09 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Tue, 11 Oct 2016 16:02:50 -0400 Subject: [PATCH] fix(shouldIgnore): filename normalization should be platform sensitive (#4631) * fix(shouldIgnore): filename normalization should be platform sensitive shouldIgnore normalizes the path of the filename prior to running any "only" regexes or functions. The normalization uses "slash", which has some undesirable special cases for non-ASCII characters and longer paths. Changing the normalization behavior to always replace path separators. There is no real need to add additional tests, because the tests are not run in an environment where path.sep !== '/'. * Minor style fix to use double quotes. * Remove conditional for regex replace to keep consistent behavior. * whitespace [skip ci] --- packages/babel-core/src/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-core/src/util.js b/packages/babel-core/src/util.js index 0ee5e62a96..4da7503e8c 100644 --- a/packages/babel-core/src/util.js +++ b/packages/babel-core/src/util.js @@ -116,7 +116,7 @@ export function shouldIgnore( ignore: Array = [], only?: Array, ): boolean { - filename = slash(filename); + filename = filename.replace(/\\/g, "/"); if (only) { for (let pattern of only) {