Make nicer stacks DEV-only

No need to spend production bytes on this.
This commit is contained in:
Dan
2018-08-09 03:44:56 +01:00
parent 54d86eb822
commit d59b993a74
+11 -8
View File
@@ -18,14 +18,17 @@ export default function(
if (source) {
let path = source.fileName;
let fileName = path.replace(BEFORE_SLASH_RE, '');
if (/^index\./.test(fileName)) {
// Special case: include closest folder name for `index.*` filenames.
const match = path.match(BEFORE_SLASH_RE);
if (match) {
const pathBeforeSlash = match[1];
if (pathBeforeSlash) {
const folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
fileName = folderName + '/' + fileName;
if (__DEV__) {
// In DEV, include code for a common special case:
// prefer "folder/index.js" instead of just "index.js".
if (/^index\./.test(fileName)) {
const match = path.match(BEFORE_SLASH_RE);
if (match) {
const pathBeforeSlash = match[1];
if (pathBeforeSlash) {
const folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
fileName = folderName + '/' + fileName;
}
}
}
}