Using Backbone model / collections without jQuery in webpack

I am learning React and looking for a solid model system - something that simplifies the request / dispatch to RESTful endpoints.

The Backbome collection / model functionality is exactly what I need and their website indicates that no jQuery is required other than the view related code.

I am using webpack including Backbone:

import Backbone from 'backbone`;

      

However, it is throwing errors in jQuery:

ERROR in ./~/backbone/backbone.js
Module not found: Error: Cannot resolve module 'jquery' in node_modules/backbone 
@ ./~/backbone/backbone.js 18:4-22:6

      

No change if I restrict my imports to Collection

or Model

.

Is there a way to get around this - jquery is completely unnecessary for my project and bloats a lot, which I don't want.

I don't see any alternative rest model / type libraries ...

+3


source to share


1 answer


If you want the model to use the backbone-model . If you need a collection, add backbone-collection .



+2


source







All Articles