skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    As I was typing this up and listing out the cache settings, I noticed the WP Rocket section for File Optimization which led me to finding a solution. By unchecking Minify HTML and Minify JavaScript file I was able to fully eliminate the issue.

    Further research uncovered that this may the caused by a dependency of WP Rocket called Minify.

    Hopefully this will help anybody else who stumbles upon the same issue. My site is running very quickly now with WP Rocket despite not minifying the HTML and JavaScript.


  2. It’s about DIVI: When you checked minify in the DIVI builder, it will regenerate the minified files each time you do a new post/page. But not the same filename, DIVI uses each time a different filename for the minified files. So if minify the minified files by another plugin you wil drive into trouble.

    Easy solution for every cache-plugin with DIVI: Uncheck minify in the DIVI-Builder and let your cache-plugin do the job

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search