Question

I'm using js/html/node-webkit to build standalone app and have an issue with loading js files. Files tree:

/
|-files/
|      |-additionals/
|      |            |-jquery.form.js
|      |-bootstrap/
|      |          |-js/
|      |          |   |-boostrap.min.js
|      |-CatalogSmall.js
|      |-jquery.js
|      |-main.js
|      |-parse2.js
|-index.html
|-index.js
|-require.js

My index.html

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type="text/javascript" data-main="index.js" src="require.js"></script>
</head>
<body>
</body>
</html>

My index.js

var appDir = "/home/user/p1";
requirejs.config(
{
    baseUrl: appDir,
    paths:
    {
        files: "files_",
        bootstrap: "files_/bootstrap/js",
        additionals: "files_/additionals",
        jui: "jui"

    }
});

requirejs(
[ "files_/jquery" ],
function ()
{
    requirejs(
        [
            "jui/jquery-ui-1.9.1.custom.min",
            "additionals/jquery.form",
            "bootstrap/bootstrap.min",
        ],
        function ()
        {
//some code
requirejs.config({ waitSeconds: 180 });
requirejs(
    ["files/CatalogSmall"],
    function ()
    {
        requirejs(
            ["files/parse2"],
            function ()
            {
                //some code
            }
        );
    }
);

CatalogSmall is a huge file in json-style

So, if I load my sripts directly from index.html there is no errors, but if I try to load them via requirejs, I have an error "Uncaught Error: Load timeout for modules: files/CatalogSmall" after 180 secs. Have no idea how to fix it.

Was it helpful?

Solution

var appDir = "/home/user/p1";

You don't have local access to files anyway, what is the point of this line? The appDir option is for the case that all your code in within a subfolder below your index.js. In this case you don't need it.

files: "files_",

This makes no sense as well. The paths object contains only module paths, not folder paths.

The options are documented here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top