We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 17244d8 + af0e3bb commit 4783923Copy full SHA for 4783923
index.js
@@ -3,11 +3,13 @@ var loaderUtils = require('loader-utils');
3
4
function processOptions(source, options) {
5
if (!_.isUndefined(options.search) && !_.isUndefined(options.replace)) {
6
+ var search = options.search;
7
+
8
if (!_.isUndefined(options.flags)) {
- options.search = new RegExp(options.search, options.flags);
9
+ search = new RegExp(options.search, options.flags);
10
}
11
- var newSource = source.replace(options.search, options.replace);
12
+ var newSource = source.replace(search, options.replace);
13
if (options.strict && (newSource === source)) {
14
throw new Error('Cannot replace ' + options.search + ' → ' + options.replace);
15
0 commit comments