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:
In 20.2 and above
Ups. Looking insane.
Examine the browser console output. At the debug level.
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
Lets consult the requirejs error page mentioned in the browser console.
A check of stackoverflow.com gave me the resolution “name collisions can produce this” so I changed the sprite.js to
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.
Disclaimer: This works for me. The usage requires proper testing and I will not be liable for any problems whatsoever on that.