Skip to content

Commit

Permalink
fix: RequireJS should be able to load js files with no extension (def…
Browse files Browse the repository at this point in the history
…ault behavior)
  • Loading branch information
ocombe committed Feb 26, 2015
1 parent 83d416f commit 4f60d05
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
32 changes: 16 additions & 16 deletions examples/requireJSExample/js/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
requirejs.config({
baseUrl: 'js/',
paths: {
'jquery':'jquery',
'angular': 'angular.min',
'test': 'testmodule',
'ngGrid': 'ng-grid-2.0.11.debug',
'ocLazyLoad':'../../../src/ocLazyLoad'
},
shim: {
'angular': ['jquery'],
'ocLazyLoad': ['angular'],
'ngGrid': ['angular'],
'lazymodule': ['test', 'ngGrid'],
'test': ['ocLazyLoad']
}
baseUrl: 'js/',
paths: {
'jquery': 'jquery',
'angular': 'angular.min',
'test': 'testmodule',
'ngGrid': 'ng-grid-2.0.11.debug',
'ocLazyLoad': '../../../src/ocLazyLoad'
},
shim: {
'angular': ['jquery'],
'ocLazyLoad': ['angular'],
'ngGrid': ['angular'],
'lazymodule': ['test', 'ngGrid'],
'test': ['ocLazyLoad']
}
});

// Start the main app logic.
requirejs(['test'], function() {
angular.bootstrap(document.body, ['test']);
angular.bootstrap(document.body, ['test']);
});
2 changes: 2 additions & 0 deletions src/ocLazyLoad.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@
if (!file_type) {
if ((m = /[.](css|less|html|htm|js)?$/.exec(path)) !== null) { // Detect file type via file extension
file_type = m[1];
} else if(!jsLoader.hasOwnProperty('ocLazyLoadLoader') && jsLoader.hasOwnProperty('load')) { // requirejs
file_type = 'js';
} else {
$log.error('File type could not be determined. ' + path);
return;
Expand Down

0 comments on commit 4f60d05

Please sign in to comment.