diff --git a/src/index.js b/src/index.js index 1596f2c7..bdf73f88 100644 --- a/src/index.js +++ b/src/index.js @@ -18,18 +18,10 @@ function lessLoader(source) { baseDataPath: 'options', }); - const done = this.async(); - const isSync = typeof done !== 'function'; - - if (isSync) { - throw new Error( - 'Synchronous compilation is not supported anymore. See https://github.com/webpack-contrib/less-loader/issues/84' - ); - } - + const callback = this.async(); const lessOptions = getLessOptions(this, options); - processResult(this, render(source, lessOptions)); + processResult(this, render(source, lessOptions), callback); } export default lessLoader; diff --git a/src/processResult.js b/src/processResult.js index 1b9bdd16..fff9074d 100644 --- a/src/processResult.js +++ b/src/processResult.js @@ -6,10 +6,9 @@ const formatLessError = require('./formatLessError'); * * @param {loaderContext} loaderContext * @param {Promise} resultPromise + * @param {Function} callback */ -function processResult(loaderContext, resultPromise) { - const { callback } = loaderContext; - +function processResult(loaderContext, resultPromise, callback) { resultPromise .then( ({ css, map, imports }) => {