diff --git a/lib/index.js b/lib/index.js index af1584a..28620be 100644 --- a/lib/index.js +++ b/lib/index.js @@ -49,7 +49,7 @@ class ReplaceText { const vals = this.values; const pats = this.patterns; const keys = Object.keys(vals).filter(k => !/[ex,in]clude|patterns/.test(k)); - const RGXP = new RegExp(keys.join('|'), 'g'); + const RGXP = new RegExp(keys.map(k => k.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")).join('|'), 'g'); const isMatch = this.isMatch; compiler.plugin('compilation', bundle => {