Configuring RequireJS
To configure RequireJS, create a file at the same level as the viewmodel.js
file lies. You can call it main.js
, and follow these steps:
Define the basic
config
method:require.config({ });
Then, define the base URL for the scripts. This is where RequireJS will look for scripts:
Require.config({ baseUrl:'js' });
Now, define aliases for the paths of the vendor libraries in the
paths
attribute. This helps you to avoid writing long paths in our module dependencies. You don't need to define the extension. RequireJS adds the extension for you:require.config({ baseUrl:'js', paths: { bootstrap:'vendors/bootstrap.min', icheck: 'vendors/icheck', jquery: 'vendors/jquery.min', mockjax: 'vendors/jquery.mockjax', mockjson: 'vendors/jquery.mockjson', knockout : 'vendors/knockout.debug', 'ko.validation':'vendors/ko.validation', 'ko-amd-helpers': 'vendors/knockout-amd-helpers', text: 'vendors/require.text' } });
Also, define dependencies inside...