Answer the question
In order to leave comments, you need to log in
How to add backbone.cocktail to webpack?
I am moving a large project to webpack. We use backbone.cocktail
Written by a small loader
{ test: /backbone\.js$/, loader: "util/backbone.coctail"}
module.exports = function () {
if (this.cacheable) this.cacheable();
// This is an async loader
var loaderAsyncCallback = this.async();
var slug = 'var Backbone = require(' + JSON.stringify("backbone") + ');\n'
+ 'var Cocktail = require(' + JSON.stringify("backbone.cocktail") + ');\n'
+ 'Cocktail.patch(Backbone);\n'
+ 'module.exports = Backbone;';
loaderAsyncCallback(null, slug);
};
/***/ 5:
/***/ function(module, exports, __webpack_require__) {
var Backbone = __webpack_require__(5);
var Cocktail = __webpack_require__(148);
Cocktail.patch(Backbone);
module.exports = Backbone;
/***/ },
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question