Skip to content
This repository was archived by the owner on Jan 3, 2019. It is now read-only.

Commit b258bc8

Browse files
committed
Mark as cacheable and use loader chaining shortcut values
1 parent 72b0585 commit b258bc8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ var MessageFormat = require('messageformat');
44
module.exports = function(content) {
55
var query = loaderUtils.parseQuery(this.query);
66
var locale = query.locale || 'en';
7-
var messages = this.exec(content);
8-
var messageFunctions = new MessageFormat(locale).compile(messages).toString('module.exports');
9-
return messageFunctions;
7+
var messages = typeof this.inputValue === 'object' ? this.inputValue : this.exec(content);
8+
var messageFunctions = new MessageFormat(locale).compile(messages);
9+
10+
this.cacheable && this.cacheable();
11+
this.value = messageFunctions;
12+
13+
return messageFunctions.toString('module.exports');
1014
};

0 commit comments

Comments
 (0)