Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Pass the proper context to the loader utils when calling interpolateName #87

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}

Expand Down Expand Up @@ -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;
Expand Down