Using Browserify in the app
Until now we have learned about what Browserify is and how to use it. Now we will apply that background to our contacts app to load all the code as Node modules.
Before we continue, ensure that you have installed all the required dependencies for the project:
{ "name": "mastering-backbone-04", // ... "dependencies": { "backbone": "^1.2.3", "backbone-validation": "^0.11.5", "body-parser": "^1.14.1", "bootstrap": "^3.3.5", "browser-sync": "^2.9.11", "crispy-string": "0.0.2", "express": "^4.13.3", "http-proxy": "^1.11.3", "jquery": "^2.1.4", "lodash": "^3.10.1", "morgan": "^1.6.1", "sweetalert": "^1.1.3", "underscore": "^1.8.3" } }
The easiest modules to convert are Models and Collections because they don't have huge dependencies.
// apps/contacts/models/contact.js 'use strict' var Backbone = require('backbone'); class Contact extends Backbone.Model { // ... } module.exports = Contact;
As you can see, the...