Skip to content

Commit

Permalink
fix(index): change loader detection to work in more environments
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 25, 2016
1 parent a2558fc commit 9a5c169
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,18 @@ function createLoader() {
return Promise.resolve(new PLATFORM.Loader());
}

if (window.require) {
return new Promise((resolve, reject) => require(['aurelia-loader-default'], m => resolve(new m.DefaultLoader()), reject));
} else if (window.System) {
if(window.System && typeof window.System.import === 'function') {
return System.normalize('aurelia-bootstrapper').then(bootstrapperName => {
return System.normalize('aurelia-loader-default', bootstrapperName);
}).then(loaderName => {
return System.import(loaderName).then(m => new m.DefaultLoader());
});
}

if(typeof window.require === 'function') {
return new Promise((resolve, reject) => require(['aurelia-loader-default'], m => resolve(new m.DefaultLoader()), reject));

This comment has been minimized.

Copy link
@niieani

niieani Nov 19, 2016

Contributor

@EisenbergEffect One more line where we need to change that require to window.require.

}

return Promise.reject('No PLATFORM.Loader is defined and there is neither a System API (ES6) or a Require API (AMD) globally available to load your app.');
}

Expand Down

0 comments on commit 9a5c169

Please sign in to comment.