Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/lib/async-component-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ module.exports.pitch = function(remainingRequest) {
this.cacheable && this.cacheable();
var query = loaderUtils.getOptions(this) || {};
var routeName = typeof query.name === 'function' ? query.name(this.resourcePath) : null;
var name = routeName !== null ? routeName : ('name' in query ? query.name : (query.formatName || String)(this.resourcePath));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew someone would undo this lovely upsetting ternary

var name
if(routeName !== null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: missing space after if keyword

name = routeName
} else if ('name' in query) {
name = query.name
} else if ('formatName' in query) {
name = query.formatName(this.resourcePath)
}

return `
import async from ${JSON.stringify(path.resolve(__dirname, '../components/async'))};
Expand Down