1

I'm making my first attempt at using the text.js plugin (v2.0.12) for require.js (v2.1.15). I've had require working well up to this point, however, when I attempt to resolve a text dependency, I get two errors. The first error is Unable to get property 'normalize' of undefined or null reference [require.js, Line: 955] then, after the allotted time, I'll get a timeout error for the html file I'm attempting to load. The focus of this cry for help is the former error.

One curious observation I've noticed is that if I resolve the text module without declaring a file, there is no error. However, when I add the file path e.g. text!path/file, the error is triggered.

Additionally, I noticed that the load timeout error references the text module with _unnormalized2 appended. Not sure if that's to be expected but I thought is odd. Any help would be greatly appreciated!

Here's the block of code which errors:

//If current map is not normalized, wait for that
//normalized name to load instead of continuing.
if (this.map.unnormalized) {
    //Normalize the ID if the plugin allows it.
    if (plugin.normalize) { // error occurs here (line 955)
        name = plugin.normalize(name, function (name) {
            return normalize(name, parentName, true);
        }) || '';
    }

    // ...
}
Vinney Kelly
  • 4,975
  • 1
  • 25
  • 31

1 Answers1

2

Ok, it turns out to have been a self-sabotage! I was creating a shortcut definition for the text module for which I left out the factory method. So, instead of

define('text', ['Scripts/text'], function(text) { return text; });

I had:

define('text', ['Scripts/text']);

Nothing to do with text.js whatsoever.

Vinney Kelly
  • 4,975
  • 1
  • 25
  • 31