0

Having buried myself in google looking for resolutions to this bug, and having found none, along with the entirety of this morning debugging trying to work out the problem I am hitting a dead end!

The bug appeared immediately after upgrading to 2.2 (subsequent upgrades to 2.2.1 and 2.2.2 have not resolved the issue), while it worked without issue on 2.1.x

The bug presents itself like below:

require.js:1895 GET static/version1518612075/frontend/ar/<vendor>/en_GB/jquery/ui.js net::ERR_ABORTED

Uncaught Error: Script error for: jquery/ui
  http://requirejs.org/docs/errors.html#scripterror
at makeError (require.js:166)
at HTMLScriptElement.onScriptError (require.js:1681)

With the odd smattering of load timeout caused by the same reason.

So interestingly before getting further into depth with this, it works absolutely FLAWLESSLY if left to self-generate the files in developer mode. However, the instant it is deployed in production via static-content:deploy, all of these issues start appearing.

Anyway, in particular the issue is caused by requirejs looking at a completely wrong path, even on stock magento defined modules:

<vendor>/en_GB/jquery/ui.js

It, in fact, should be looking for either of the following:

<vendor>/en_GB/jquery/jquery-ui.js
<vendor>/en_GB/jquery/jquery-ui-1.9.2.js

All of the requirejs-config.js path/maps reference the above (minus .js ofcourse). It is almost like it is breaking down the dependency definition and instead using that to generate a path.

Not the only file that is affected, have Aheadworks, Amasty, other core Magento modules, across the board issue.

It's not the static asset issue with nginx that was fixed in 2.1.x, using the correct nginx config for that.

Wondering if any else has come across this?

Thanks.

0

So this turned out to be an empty requirejs_config.js within the theme module.

When M2 is building its static content in production mode and running its combination routine to combine all of the requirejs_config files into the one file, it checks within the theme module for a requirejs_config.js file. If this exists, it will take this file first and copy it across to the static folder, and subsequently dump everything that it has created up to that point (not quite sure why it does it this way around as it seems notably inefficient).

In our instance, as the file was empty, this was what was killing our javascript as it would never load anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.