javascriptrequirejsdurandaldurandal-2.0weyland

Durandal Weyland optimizations doesn't handle the require function


I've found out that weyland optimizer replaces the paths in the javascript files with their real values. But it doesn't replace the paths used in middle of the code using require function.

For example:

require('myscripts/mymodule', function(mymodule){
    // do something after mymodule is ready.
}

and I'm defined myscripts as a path like:

'myscripts': 'api/ScriptHandler/GetModule'

Solution

  • RequireJS' optimizer needs its build file to have findNestedDependencies: true to find such cases. If Weyland uses RequireJS' optimizer behind the scenes (ETA: it does) this might be the solution.