Skip to content

Commit 462ae5f

Browse files
committed
Improve check for empty content
This has been removed accidentally by a previous commit.
1 parent 911a774 commit 462ae5f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/loader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const asyncSassJobQueue = async.queue(sass.render, threadPoolSize - 1);
2121
* @param {string} content
2222
*/
2323
function sassLoader(content) {
24-
content = content || '//';
2524
const callback = this.async();
2625
const isSync = typeof callback !== "function";
2726
const self = this;
@@ -44,6 +43,12 @@ function sassLoader(content) {
4443
addNormalizedDependency
4544
));
4645

46+
// Skip empty files, otherwise it will stop webpack, see issue #21
47+
if (options.data.trim() === "") {
48+
callback(null, "");
49+
return;
50+
}
51+
4752
// start the actual rendering
4853
asyncSassJobQueue.push(options, (err, result) => {
4954
if (err) {

0 commit comments

Comments
 (0)