Support ES6 default named exports for Backbone-ES6 #194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This subtle change takes into account how ES6 modules export default named modules and how they are consumed in the UMD loading code of Backbone.localStorage. backbone-es6 (https://github.com/typhonjs/backbone-es6) is a fork of Backbone using ES6. The ES6 module output
export default backbone;
found in ModuleRuntime.js (https://github.com/typhonjs/backbone-es6/blob/master/src/ModuleRuntime.js#L39) puts the actual reference under a default named key in the ES5 UMD loading code.A complete TODOs demo using Backbone-ES6 and Backbone.localStorage can be found here:
http://js.demos.typhonrt.org/backbone-es6-localstorage-todos/
and repo of the demo:
https://github.com/typhonjs-demos/backbone-es6-localstorage-todos
The change in this PR adds a check for the existence of
Backbone.default
in the resolution of callingfactory
in the Backbone.localStorage UMD wrapper.