From cc77f38236214ed32cec91e19d5da95900505de4 Mon Sep 17 00:00:00 2001 From: ok500 Date: Mon, 21 Jan 2019 12:04:41 +0000 Subject: [PATCH] Pass the proper context to the loader utils when calling interpolateName --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 584d278..d1771f0 100644 --- a/index.js +++ b/index.js @@ -28,12 +28,12 @@ function getExtractedSVG(svgStr, query) { if (!!config.classPrefix) { const name = config.classPrefix === true ? '__[hash:base64:7]__' : config.classPrefix; - config.classPrefix = loaderUtils.interpolateName({}, name, { content: svgStr }); + config.classPrefix = loaderUtils.interpolateName(this, name, { content: svgStr }); } if (!!config.idPrefix) { const id_name = config.idPrefix === true ? '__[hash:base64:7]__' : config.idPrefix; - config.idPrefix = loaderUtils.interpolateName({}, id_name, { content: svgStr }); + config.idPrefix = loaderUtils.interpolateName(this, id_name, { content: svgStr }); } } @@ -62,7 +62,7 @@ function SVGInlineLoader(content) { // Configuration var query = loaderUtils.parseQuery(this.query); - return "module.exports = " + JSON.stringify(getExtractedSVG(content, query)); + return "module.exports = " + JSON.stringify(getExtractedSVG.call(this, content, query)); } SVGInlineLoader.getExtractedSVG = getExtractedSVG;