From 508fdd3b37ef9bdc516da3988a6a68cf0e38e0f7 Mon Sep 17 00:00:00 2001 From: Joel Denning Date: Fri, 7 Sep 2018 12:12:40 -0600 Subject: [PATCH 1/2] Adding support for wepback 4 --- index.js | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 9155314..52765bc 100644 --- a/index.js +++ b/index.js @@ -14,10 +14,11 @@ var dictionary = { }; module.exports = function(content) { + var options = loaderUtils.getOptions(this) = {} this.cacheable && this.cacheable(); - var query = loaderUtils.parseQuery(this.query); + var query = this.resourceQuery ? loaderUtils.parseQuery(this.resourceQuery) : {} var ext = loaderUtils.interpolateName(this, "[ext]", { - context: query.context || this.options.context, + context: query.context || options.context || undefined, content: content, regExp: query.regExp }).toLowerCase(); diff --git a/package.json b/package.json index e5c7e53..c36dffb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "index.js" ], "dependencies": { - "loader-utils": "~0.2.5" + "loader-utils": "^1.1.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 34f11f42f92c9c08d1f439aa428942764075a822 Mon Sep 17 00:00:00 2001 From: Joel Denning Date: Fri, 7 Sep 2018 13:32:33 -0600 Subject: [PATCH 2/2] Fixing typo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 52765bc..ac7cb7a 100644 --- a/index.js +++ b/index.js @@ -14,7 +14,7 @@ var dictionary = { }; module.exports = function(content) { - var options = loaderUtils.getOptions(this) = {} + var options = loaderUtils.getOptions(this) || {} this.cacheable && this.cacheable(); var query = this.resourceQuery ? loaderUtils.parseQuery(this.resourceQuery) : {} var ext = loaderUtils.interpolateName(this, "[ext]", {