The famous “define is not defined” Error (or “Mismatched anonymous define modules)

In the content server 20.4 you’ll encounter from time to time a requirejs error “define is not defined”. Normally on defining icons. This is very entertaining.

In 16.2.10 the same thing worked as a charm.

Dont panic, in the “Hitchhikers Guide to the Galaxy” you’ll find the solution.

42 (As always)

(Just kidding. Lets be serious.)


The case in 16.2.10:

Screenshot in 16.2.x

In 20.2 and above

The same perspective in 20.2 and later

Ups. Looking insane.


Examine the browser console output. At the debug level.

Browser Console
Browser Console

As a nice addition for the entertainment, the module is uglyfied, it makes no sense to search for this strings, as they are produced during the grunt tasks. But on the other hand, a couple of lines further down there are some complaints of the grid.view.js that the “getSpritePath” is missing. And the offending module is supposed to return the getSpritePath function.

So, a search on getSpritePath gave the offending module, the sprite.js, which was introduced in 20.2 and is obviously required, when a widget wants to display sprites.

The module shows

Original Sprite.js

Lets consult the requirejs error page mentioned in the browser console.

Requirejs Error page

A check of gave me the resolution “name collisions can produce this” so I changed the sprite.js to

Changed sprite.js
Changed Sprite.js

Changed the function argument from require to requireReiner. The name doesnt matter.


Everything runs under 20.2 like it used to in previous releases. No more mismatched anonymous define() modules.

But be careful: You’ll get the old js file in all new SDK releases. You should override the old file with the corrected one in all js projects.

As always:

Disclaimer: This works for me. The usage requires proper testing and I will not be liable for any problems whatsoever on that.