@samitouri / QOS-React-2 / commits / d59b993a74

Make nicer stacks DEV-only

No need to spend production bytes on this.

Dan committed Aug 9, 2018 at 03:44 UTC d59b993a746548aaa7b9dad43461ec41ca08827b
1 file changed +11 -8
packages/shared/describeComponentFrame.js
+11 -8
@@ -18,14 +18,17 @@ export default function(
18 if (source) {
19 let path = source.fileName;
20 let fileName = path.replace(BEFORE_SLASH_RE, '');
21 - if (/^index\./.test(fileName)) {
22 - // Special case: include closest folder name for `index.*` filenames.
23 - const match = path.match(BEFORE_SLASH_RE);
24 - if (match) {
25 - const pathBeforeSlash = match[1];
26 - if (pathBeforeSlash) {
27 - const folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
28 - fileName = folderName + '/' + fileName;
21 + if (__DEV__) {
22 + // In DEV, include code for a common special case:
23 + // prefer "folder/index.js" instead of just "index.js".
24 + if (/^index\./.test(fileName)) {
25 + const match = path.match(BEFORE_SLASH_RE);
26 + if (match) {
27 + const pathBeforeSlash = match[1];
28 + if (pathBeforeSlash) {
29 + const folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
30 + fileName = folderName + '/' + fileName;
31 + }
32 }
33 }
34 }