Skip to content

Commit 9515410

Browse files
Sawtaytoesmichael-ciniawsky
authored andcommitted
fix(index): don't prepend ./ to the URL on interpolate=require (options.interpolate) (#165)
1 parent 5af6884 commit 9515410

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,16 @@ module.exports = function(content) {
147147

148148
return exportsString + content.replace(/xxxHTMLLINKxxx[0-9\.]+xxx/g, function(match) {
149149
if(!data[match]) return match;
150-
return '" + require(' + JSON.stringify(loaderUtils.urlToRequest(data[match], root)) + ') + "';
150+
151+
var urlToRequest;
152+
153+
if (config.interpolate === 'require') {
154+
urlToRequest = data[match];
155+
} else {
156+
urlToRequest = loaderUtils.urlToRequest(data[match], root);
157+
}
158+
159+
return '" + require(' + JSON.stringify(urlToRequest) + ') + "';
151160
}) + ";";
152161

153162
}

0 commit comments

Comments
 (0)