1
votes

In windows when I cmd: D:\web\TechnicalAssistance>call node src/vendor/r.js -o baseUrl=src name=main out=production/build.js optimize=none

I get this error:Tracing dependencies for: main; Error: ENOENT, no such file or directory 'D:\web\TechnicalAssistance\src\jquery.js'. In module tree: main

Well this script is not looking in the right path to find jquery, it should be looking into D:\web\TechnicalAssistance\src\vendors\jquery-1.9.1.js

My main.js file:

requirejs.config({
    baseUrl: ".",
    paths: {
        "jquery": "vendor/jquery-1.9.1"
        ,"jquery-ui": "vendor/jquery-ui.min"
        //,"bootstrap": "vendor/bootstrap.min"
    },
    shim: {
         "jquery": []
        ,"jquery-ui": ['jquery']
        //,"bootstrap": { deps: ["jquery"] }
    }
});


require(["one"
        ,"two"
        ,"vendor/requirejs/require.js"
        ,"jquery"
        //,"bootstrap"
        ], function (one, two) {
    one.action()
    two.action()
});

If I require like this: "vendor/jquery-1.9.1" instead of just "jquery" as I named, it works! But I don't want to require like this instead of jquery. As you can see I set the path of jquery to "vendor/jquery-1.9.1" and then I shim it "jquery": []; Then I require it in the method below. If I run the un-build file it works! But If I want to build my file it doesn't work as explained above.

What I'm missing here?

2

2 Answers

1
votes

Check out the mainConfigFile Option:

D:\web\TechnicalAssistance>call node src/vendor/r.js -o baseUrl=src name=main out=production/build.js optimize=none mainConfigFile=src/main.js
0
votes

So I have to include the path of the build.js like this: D:\web\TechnicalAssistance>call node src/vendor/r.js -o src/build.js baseUrl=src name=main out=production/build.js optimize=none

And copy a port of my main.js to the build.js:

{
    baseUrl: ".",
    paths: {
         "jquery": "vendor/jquery-1.9.1"
        ,"jquery-ui": "vendor/jquery-ui.min"
        ,"bootstrap": "vendor/bootstrap.min"
    },
    shim: {
        "jquery": []
        ,"jquery-ui": ['jquery']
        ,"bootstrap": { deps: ["jquery"] }
    }
}

This is kind of redundant, why doesn't the requirejs just read this data from the main.js file? ok, now it works but you have to update the 2 files and keep them synced...