This repo contains an ES6 version of Backbone.js allowing for imports and tree shaking.
This package is made by deconstructing Backbone sources, separating it into modules and reassembling them using JSPM+Rollup.
Tree shaking allows you to include just the code you need instead of a whole library. Say, for example, your app needs to use just Backbone's router, you can import just that part, resulting in a smaller build size overall.
It depends. Is your project already using ES6 imports? If it isn't, don't worry. There is an umd
compatible build in the dist
folder that's also used to run the tests. Said tests are the same as the ones in the official Backbone repo, to ensure Backbone ES6's compatibility with good old vanilla Backbone.
AMD usage of our umd version is as follows:
define([
'jquery',
'underscore',
'backbone.umd.js'
],function($, _, Backbone) {
Backbone = 'default' in Backbone ? Backbone.default : Backbone;
...your code...
});
Nope. The inner working of Backbone entities and the way they extend is kept as-is. This project is only a POC to do imports and tree shaking. No more, no less.