diff --git a/lib/misc/sw-loader.js b/lib/misc/sw-loader.js index 9c3f8c67..4d28a796 100644 --- a/lib/misc/sw-loader.js +++ b/lib/misc/sw-loader.js @@ -16,8 +16,8 @@ module.exports.pitch = function pitch(remainingRequest, precedingRequest, data) var callback = this.async(); var templatePath = path.join(__dirname, 'sw-template.js'); - var query = loaderUtils.parseQuery(this.query); - var params = JSON.parse(query.json); + var options = loaderUtils.getOptions(this); + var params = JSON.parse(options.json); var request = loaderUtils.stringifyRequest(this, remainingRequest); var source = 'module.exports = require(' + request + ')'; diff --git a/package.json b/package.json index d43cc51a..cf4415d4 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "dependencies": { "deep-extend": "^0.5.1", "ejs": "^2.3.4", - "loader-utils": "0.2.x", + "loader-utils": "^1.1.0", "minimatch": "^3.0.3", "slash": "^1.0.0" }, diff --git a/src/misc/sw-loader.js b/src/misc/sw-loader.js index 9e24cd6c..75f1ce4a 100644 --- a/src/misc/sw-loader.js +++ b/src/misc/sw-loader.js @@ -12,8 +12,8 @@ module.exports.pitch = function pitch(remainingRequest, precedingRequest, data) const callback = this.async(); const templatePath = path.join(__dirname, 'sw-template.js'); - const query = loaderUtils.parseQuery(this.query); - const params = JSON.parse(query.json); + const options = loaderUtils.getOptions(this); + const params = JSON.parse(options.json); const request = loaderUtils.stringifyRequest(this, remainingRequest); const source = 'module.exports = require(' + request + ')';