Cache loader result

This commit is contained in:
Jan Nicklas 2015-06-29 17:04:36 +02:00
parent 387ca2448a
commit 6b59214353
1 changed files with 3 additions and 3 deletions

View File

@ -3,6 +3,9 @@ var loaderUtils = require('loader-utils');
module.exports = function (source) {
'use strict';
if (this.cacheable) {
this.cacheable();
}
var allLoadersButThisOne = this.loaders.filter(function(loader) {
return loader.module !== module.exports;
});
@ -11,9 +14,6 @@ module.exports = function (source) {
return source;
}
// Use underscore for a minimalistic loader
if (this.cacheable) {
this.cacheable();
}
var options = loaderUtils.parseQuery(this.query);
var template = _.template(source, options);
return 'module.exports = ' + template;