I've recently implemented WP Rocket on my WordPress site and suddenly it's not rendering correctly. I'm getting this error message in the console:
Uncaught SyntaxError: Invalid regular expression: missing /
I can clear the cache and it loads the first time I load it, but then fails to fully render on all subsequent loads. I've disabled all other plugins and I still get the same error. I'm using a popular theme Divi which is not seeing the same issues on other sites I've got with Divi.
I created a blank site with Divi and loaded only WP Rocket with the same settings. Turns out the page fully loads, but I still get the same error in the console:
Uncaught SyntaxError: Invalid regular expression: missing /
I'm fairly certain it's related to the WP Rocket cache at this point. Here's the full WP Rocket cache settings:
- [x] Enable caching for mobile devices
- [x] Separate cache files for mobile devices
- [ ] Enable caching for logged-in WordPress users
- Cache Lifespan: 1 Day
I've seen others post about this same issue, but no solutions other than clearing the cache - which only works on the very next load, not subsequent ones.