Apply form phone dropdown not working with WP-Optimize (or other JavaScript minifiers)

The problem

If your site uses WP-Optimize with JavaScript minification turned on, the LimeStaff application form can stop working. The usual signs:

  • The phone number country dropdown doesn’t appear or doesn’t respond.
  • Phone numbers aren’t formatted or validated as you type.
  • The browser console (F12 → Console) shows this error:
    Uncaught SyntaxError: Cannot use import statement outside a module
    

Why it happens

The apply form script (apply-form.js) is an ES module. LimeStaff loads it with type="module" because it imports the phone number library that powers the country dropdown and validation.

WP-Optimize’s minifier merges scripts into one regular (non-module) bundle. When apply-form.js ends up in that bundle, it loses its type="module" attribute. The browser then rejects the import statement and the script doesn’t run.

The fix: exclude LimeStaff from minification

  1. In your WordPress admin, go to WP-Optimize → Minify.
  2. Open the JavaScript tab.
  3. In the Exclude JavaScript from processing box, add this on its own line:
    /wp-content/plugins/LimeStaff/
    

    If you only want to exclude the apply form script, use this instead:

    /wp-content/plugins/LimeStaff/assets/js/frontend/apply-form.js
    
  4. Click Save changes.
  5. Go to the Status tab and click Purge the minified files. If you also use a page cache (in WP-Optimize, your host, or a CDN), clear that too.
  6. Open a job’s application page in a private/incognito window and check that the phone country dropdown works.

Note: The path has to match your plugin folder name exactly, and it’s case-sensitive. If your plugin folder has a different name (for example limestaff), check Plugins → Plugin File Editor or your server’s wp-content/plugins/ directory and use that name.

Using a different optimization plugin?

Other plugins that combine or minify JavaScript can cause the same problem, including Autoptimize, WP Rocket, LiteSpeed Cache, SiteGround Speed Optimizer, and Hummingbird. The fix works the same way: find the plugin’s JavaScript exclusion setting, add /wp-content/plugins/LimeStaff/ (or just the apply-form.js path above), then clear all caches.

Some plugins also offer “defer” or “delay JavaScript” options. If the form still doesn’t work after you add the exclusion, add the same path to those exclusion lists too.

Still having trouble?

Contact support and include:

  • The console error you’re seeing.
  • Which optimization or caching plugins you’re running.