From 911a7744cef1ce61a89b2910a14078ea63a3b909 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Mon, 6 Mar 2017 16:36:15 -0800 Subject: [PATCH 1/2] add comment as content string fallback --- lib/loader.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/loader.js b/lib/loader.js index b5ec35bd..8584e66e 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -21,6 +21,7 @@ const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1); * @param {string} content */ function sassLoader(content) { + content = content || '//'; const callback = this.async(); const isSync = typeof callback !== "function"; const self = this; From 462ae5f49cdf8048833f7c159f1f9bf62b022b14 Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Tue, 7 Mar 2017 19:10:32 +0100 Subject: [PATCH 2/2] Improve check for empty content This has been removed accidentally by a previous commit. --- lib/loader.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/loader.js b/lib/loader.js index 8584e66e..da601753 100644 --- a/lib/loader.js +++ b/lib/loader.js @@ -21,7 +21,6 @@ const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1); * @param {string} content */ function sassLoader(content) { - content = content || '//'; const callback = this.async(); const isSync = typeof callback !== "function"; const self = this; @@ -44,6 +43,12 @@ function sassLoader(content) { addNormalizedDependency )); + // Skip empty files, otherwise it will stop webpack, see issue #21 + if (options.data.trim() === "") { + callback(null, ""); + return; + } + // start the actual rendering asyncSassJobQueue.push(options, (err, result) => { if (err) {