Requirejs requires text! with a relative path cause an abnormal error on the iphone, the rate works on the emulator

I use requirejs with telephony and load some text file into the module definition, like this

define(['text!../configuration/systemcore.cfg', //config files 'text!../language/cn.systemcore.lang', //languagefiles 'Configuration', 'DatabaseHandler', 'Language', //framework js 'FileHandler', 'NotificationHandler', 'BaseModule' //base classes ], function(cfg, lang, Configuration, DatabaseHandler, Language, FileHandler, NotificationHandler, BaseModule) { 

Everything works fine in the ios emulator, but after downloading to the ios device it calls

an abnormal error in a text file that causes a load module timeout, why ...

+4
source share
2 answers

Ok, I added the text: path / to / text.js to requirejs.config ({patch: {...}}) and it solved the problem. It is still strange how it can work earlier in the emulator when I do not specifically point to text.js

+1
source

Perhaps this answer is not a solution for this specific question, but, nevertheless, this topic I found is looking for a similar problem: an abnormal error and a timeout for loading in the console, so it may be useful to post it here.

The text plugin does not seem to work correctly if referenced twice in different paths (from my experience).

eg. if you reference the full path first:

 define(["js/libs/text!somefile.html"], ...) 

and then config requireJS path and use an alias for it:

 require.config({paths: { "text": "js/libs/text.js" }}); define(["text!somefile.html"], ...) 

it loads the same module twice, and the second define causes an error. Correct me if I am wrong.

-2
source

Source: https://habr.com/ru/post/1491265/


All Articles