From 6b59214353a824976871eb35a5d494f8e9c75d08 Mon Sep 17 00:00:00 2001 From: Jan Nicklas Date: Mon, 29 Jun 2015 17:04:36 +0200 Subject: [PATCH] Cache loader result --- loader.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/loader.js b/loader.js index 64fc5ab..f801dd8 100644 --- a/loader.js +++ b/loader.js @@ -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;