0

Why do I need to name the path, and define the module again, isn't that redundant?

requirejs.config({
    paths: {
        'text': '../Scripts/text',
        'durandal': '../Scripts/durandal',
        'plugins': '../Scripts/durandal/plugins',
        'transitions': '../Scripts/durandal/transitions',
        'knockout': '../Scripts/knockout-2.3.0',
        'jquery' : '../Scripts/jquery-1.9.1,'
    }
})


//Didn't we already define the route "jquery" to point tot he AMD module above? 
//So why are we repeating this, by defining the jQuery to point to a global function?  
define('jquery', function() { return jQuery; }); 
define('knockout', ko); //The example won't run without this, but why?
Alwyn
  • 8,079
  • 12
  • 59
  • 107
  • Which tutorial is it in? Which durandal version is it? It was required in old version but since Durandal 2.0 there is no need these settings... – nemesv Mar 05 '14 at 07:43
  • nemesv, I got the latest from Nuget. This is a starter template for Durandal project. – Alwyn Mar 05 '14 at 07:48
  • If you want to AMD load jquery and knockout you need to remove them from the vendor bundle in the `DurandalBundleConfig` comment out the lines: `.Include("~/Scripts/jquery-{version}.js")` and `.Include("~/Scripts/knockout-{version}.js")` then you should not need the extra `define` lines after setting up the correct paths. But if you load jquery with require.js then you need to load bootstrap as well otherwise it won't work correctly. – nemesv Mar 05 '14 at 07:57

0 Answers0