locked
RequireJS times out running as Web context in WinJS app

    Question

  • We have a SPA that is built around RequireJS for module dependency management. The modules we vary in functionality; from helper libraries to composite visual element blocks that make up the UI for the web app. Our single index.html page has the typical entry point for RequireJS.

    <script data-main="js/main.js" src="js/libs/require/require.js"></script>
    

    With main.js specifying the config for launching the app

    requirejs.config({
        paths: {
            jQuery: 'libs/jquery.2.1.0.min',
            ...
            ...
        },
        shim: {
            ...
            ...
        },
        waitSeconds: 30
    });
    
    define(['mod1', 'mod2'], function(mod1, mod2) {
        mod2(mod1);
    });
    

    This is all fine on browsers, but now we are trying to see how our highly dynamic app behaves as a Windows Store app running WinJS. On initial conversion (with sufficient MSApp.execUnsafeLocalFunction) and testing it seemed ok. RequireJS could load and render the visual modules as expected. Then this error was observed

    APPHOST9601: Can’t load <https://static.resource.net/fonts/icons.eot?#iefix>. An app can’t load remote web content in the local context.
    File: index.html
    
    APPHOST9601: Can’t load <https://static.resource.net/fonts/icons.woff>. An app can’t load remote web content in the local context.
    File: index.html
    
    APPHOST9601: Can’t load <https://static.resource.net/fonts/icons.ttf>. An app can’t load remote web content in the local context.
    File: index.html
    

    Which seems like a WinJS app operating as Local context cannot get around. So an attempt to run it as Web context via iframe wrapper

    <!DOCTYPE html>
    <html style="width:100%;height:100%">
    <body style="width:100%;height:100%">
        <iframe style="width:100%;height:100%;border-style:none" src="ms-appx-web:///index.html"></iframe>
    </body>
    </html>
    

    yield a different kind of error, this time from RequireJS

    Unhandled exception at line 1765, column 3 in ms-appx-web://d8fa06d6-44e1-41ff-abc4-90906d290176/js/libs/require/require.js
    
    0x800a139e - JavaScript runtime error: Script error
    
    http://requirejs.org/docs/errors.html#scripterror
    
    
    Unhandled exception at line 1765, column 3 in ms-appx-web://d8fa06d6-44e1-41ff-abc4-90906d290176/js/libs/require/require.js
    
    0x800a139e - JavaScript runtime error: Load timeout for modules:
    jQueryTransit,
    SockJS,
    jQueryUiEasings
    
    http://requirejs.org/docs/errors.html#timeout
    
    If there is a handler for this exception, the program may be safely continued.
    

    Am not sure what about Web context would cause RequireJS to run into timeout situations? How is Local context in this sense able to load up everything nicely?


    The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral



    • Edited by icelava Friday, October 24, 2014 8:16 AM
    Friday, October 24, 2014 4:37 AM

Answers

  • Argh. It was because of the wrong jQuery file name. It should be jquery-2.1.0.min instead of jquer.2.1.0.min

    jQuery: 'libs/jquery-2.1.0.min',

    The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

    • Marked as answer by icelava Friday, October 24, 2014 8:28 AM
    Friday, October 24, 2014 8:27 AM

All replies

  • Argh. It was because of the wrong jQuery file name. It should be jquery-2.1.0.min instead of jquer.2.1.0.min

    jQuery: 'libs/jquery-2.1.0.min',

    The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

    • Marked as answer by icelava Friday, October 24, 2014 8:28 AM
    Friday, October 24, 2014 8:27 AM
  • Good to know :)

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 27, 2014 1:07 AM
    Moderator