Skip to content

Commit 7ab6a2e

Browse files
committed
Add deprecation warning for synchronous compilation
#84
1 parent 2e8686e commit 7ab6a2e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ var less = require("less");
99
var fs = require("fs");
1010
var loaderUtils = require("loader-utils");
1111
var path = require("path");
12+
var util = require("util");
1213

1314
var trailingSlash = /[\\\/]$/;
1415

@@ -59,7 +60,6 @@ module.exports = function(source) {
5960
}
6061

6162
less.render(source, config, function(e, result) {
62-
var parsedMap;
6363
var cb = finalCb;
6464
// Less is giving us double callbacks sometimes :(
6565
// Thus we need to mark the callback as "has been called"
@@ -128,7 +128,7 @@ function getWebpackFileManager(less, loaderContext, query, isSync) {
128128
});
129129
};
130130

131-
WebpackFileManager.prototype.loadFileSync = function(filename, currentDirectory, options, environment) {
131+
WebpackFileManager.prototype.loadFileSync = util.deprecate(function(filename, currentDirectory, options, environment) {
132132
var moduleRequest = loaderUtils.urlToRequest(filename, query.root);
133133
// Less is giving us trailing slashes, but the context should have no trailing slash
134134
var context = currentDirectory.replace(trailingSlash, "");
@@ -142,7 +142,7 @@ function getWebpackFileManager(less, loaderContext, query, isSync) {
142142
contents: data,
143143
filename: filename
144144
};
145-
};
145+
}, "We are planing to remove enhanced-require support with the next major release of the less-loader: https://github.com/webpack/less-loader/issues/84");
146146

147147
return WebpackFileManager;
148148
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"author": "Tobias Koppers @sokra",
55
"description": "less loader module for webpack",
66
"scripts": {
7-
"test": "mocha -R spec",
7+
"test": "node --no-deprecation node_modules/.bin/_mocha -R spec",
88
"test-source-map": "webpack --config test/sourceMap/webpack.config.js && open ./test/sourceMap/index.html"
99
},
1010
"peerDependencies": {

0 commit comments

Comments
 (0)