RegEx not working client side when deployed

Hi there,

I’m trying to use a simple regex match. Unfortunately I’m unable to get it to work in the production setup:

  1. meteor dev | server side : works
  2. meteor dev | client side : works
  3. production | server side : works
  4. production | client side : doesn’t work!

Do you have any idea why this could be the case?


const re = /m\.(\w+)/g; // same with new RegExp('m\\.(\\w+)', 'g');
match = re.exec(stringToMatch);
console.log(match); // returns the match object in 1-3 and null in 4

Prints the match object in 1-3. and null in 4.

What is the string you’re trying to match?

here is one example of such a string m => m.valueA + m.valueB , the regex retrieves valueA in group 1

I have found the cause. It is caused by the minify process which is changing the variable name causing the m in the string to turn into a different letter. hmm, how do I avoid that?