diff --git a/index.js b/index.js index 6e9f3ad..2ef8200 100644 --- a/index.js +++ b/index.js @@ -31,16 +31,20 @@ function resolveUrlLoader(content, sourceMap) { /* jshint validthis:true */ // details of the file being processed + // we would normally use compilation.getPath(options.output.path) to get the most correct outputPath, + // however we need to match to the sass-loader and it does not do so var loader = this, filePath = loader.context, - outputPath = loader.options.output.path, - options = defaults(loaderUtils.parseQuery(loader.query), loader.options[camelcase(PACKAGE_NAME)], { - absolute : false, - sourceMap: false, - fail : false, - silent : false, - root : null - }); + outputPath = path.resolve(loader.options.output.path); + + // prefer loader query, else options object, else default values + var options = defaults(loaderUtils.parseQuery(loader.query), loader.options[camelcase(PACKAGE_NAME)], { + absolute : false, + sourceMap: false, + fail : false, + silent : false, + root : null + }); // validate root directory var resolvedRoot = (typeof options.root === 'string') && path.resolve(options.root),