Initial assessment without passwords Quote before intervention One accountable specialist from start to finish

Css Javascript Browser

A Minified JavaScript File Causes Errors Only in Production

Diagnose WordPress JavaScript that fails only after production minification by isolating files, order, syntax and stale cache combinations.

The feature works in staging or when optimisation is disabled, but production reports an error inside a one-line minified bundle. The original code may rely on execution order, contain syntax the optimiser mishandles or be combined with a stale dependency.

Restore the critical user journey first, then reproduce the smallest failing transformation.

Capture the public failure precisely

Test as a logged-out visitor and record the page, action, browser, error text, script URL and line/column. Save the stack trace and network response status.

Check whether the error occurs on first load, after navigating between pages or only after opening a component. A cached visitor can receive a different bundle from a fresh session.

If forms or checkout are broken, use the optimiser’s supported bypass or disable the specific JavaScript transformation while diagnosing. Keep the previous configuration documented.

Confirm which optimisation stage causes it

In staging, test these states separately:

  1. original individual files;
  2. minified but not combined;
  3. combined without minification;
  4. delayed or deferred after minification;
  5. the complete production configuration.

The first state where the error appears narrows the cause. Do not toggle minify, combine and delay together and call the group “the optimiser.”

Keep theme, plugin versions and page content aligned with production so the comparison is meaningful.

Map the bundle back to source files

Use the optimiser’s manifest, source comment or debug mode to list files inside the bundle. Search original sources for the failing function or a nearby string.

If a legitimate source map is produced, browser developer tools can map the stack to the original line. Do not expose private source maps publicly merely for easier diagnosis; configure access according to the project’s security policy.

Compare the response content with the current manifest. A CDN may serve an old bundle under a reused URL.

Look for execution-order dependencies

Combining files can change order when dependencies were expressed only through separate script tags. One plugin might expect jQuery or a global configuration object to exist first.

WordPress scripts should register dependencies explicitly. Custom code can use:

wp_enqueue_script(
    'site-checkout',
    get_stylesheet_directory_uri() . '/js/checkout.js',
    array('jquery', 'wc-checkout'),
    '1.4.0',
    true
);

Use real verified handles. Do not copy this checkout example into a site that registers different dependencies.

Inline “before” and “after” data must remain beside the correct handle. Moving it into an aggregate can invert the required sequence.

Check syntax and unsafe transformations

Older minifiers can fail on newer JavaScript syntax, regular expressions or code that depends on function/class names. Third-party scripts may already be minified and should not be processed again.

Exclude the smallest proven file from minification while preserving its normal load order. If you own the source, update the build tool or correct unsafe code rather than maintaining a permanent broad exclusion.

Never hand-edit the generated one-line bundle; it will be regenerated and is not the source of truth.

Eliminate stale cache combinations

Version bundle URLs when their content changes. Purge the affected HTML and exact asset URL through supported controls, then test a fresh session.

A new HTML document referencing an old deleted bundle produces a 404; old HTML referencing a newly overwritten bundle can create incompatible code. Atomic deployment or content-hashed filenames avoid that mismatch.

Do not flush every production cache repeatedly. It increases origin load and makes the failure harder to reproduce.

Run regression checks

After the narrow repair, test navigation, forms, consent, sliders and authorised checkout flows. Review the console on several templates and browsers.

Confirm the production asset is minified or excluded exactly as intended, loads once and remains stable across a second cached visit. Record the responsible file and reason for exclusion so a future plugin update prompts review.

Request an assessment when the bundle manifest is unavailable, different cache layers serve inconsistent code or payment/form dependencies are involved. Share the public error evidence first and arrange secure access only after scope is agreed.

BEFORE YOU SEND THE REQUEST

Frequently asked questions.

Do you ask for passwords in the form?+

No. The public form never requests access. Secure credentials are requested only after the scope and quote are approved.

Who reviews the incident?+

The request goes to Jordi Ensenyat, founder of Code Barcelona and a WordPress specialist with more than 15 years of experience.

Is anything changed before the quote?+

No. Visible symptoms and scope are reviewed first. Intervention begins after approval and with a rollback path prepared.

Do you work internationally?+

Yes. WP Repair handles WordPress and WooCommerce incidents in English and Spanish through a remote service.

Assess my incident