Handling Require.js in Magento 2 (Only for Clerk v1)

Make sure that Clerk.js can be loaded when using Require.js

This guide only applies when using up to v.2.8.3 of the Magento 2 Clerk extension.

In some setups, Require.js stops Clerk.js from loading, which means that no sliders or search results will be shown.

When this happens, the following error will be shown in your console:

Uncaught ReferenceError: Clerk is not defined

The Magento 2 extension already handles Require.js, but in some cases, its necessary to have it ignore Clerk.js.

You can do this in the following file:

vendor->clerk->magento2->templates->tracking.phtml

Simply insert  window.__clerk_ignore_requirejs = true;

in the top of the tracking script:

After using this approach, Require.js will now be compatible with Clerk.io.