mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Make nicer stacks DEV-only
No need to spend production bytes on this.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user