Here is (part of) my folder structure:
- node-test
- bower_components
- build
- public
- main.js
- build.js
Running the optimizer with r.js -o build.js
and the following configuration works fine:
// main.js file
requirejs.config({
baseUrl: '../bower_components',
paths: {
'domready': 'domready/ready',
'jquery': 'jquery/jquery',
}
});
requirejs(['domready', 'jquery'], function (domReady, $) {
domReady(function () {
});
});
// build.js file
({
baseUrl: "bower_components",
name: "./almond/almond",
include: "./../public/main",
out: "build/main.js",
paths: {
'domready': 'domready/ready',
'jquery': 'jquery/jquery',
},
preserveLicenseComments: false
})
However, if I remove paths
configuration in build.js
it doesn't work anymore:
Tracing dependencies for: ./almond/almond Error: ENOENT, no such file or directory 'C:\Users\Marco\Documents\Progetti\nodejs-opt\bower_components\domready.js' In module tree: ../public/main
Error: Error: ENOENT, no such file or directory 'C:\Users\Marco\Documents\Progetti\nodejs-opt\bower_components\domready.js' In module tree: ../public/main
at Object.fs.openSync (fs.js:427:18)
I'd like to be DRY, avoiding adding a dependency twice. Is this possible?