Reputation: 703
Being new to Webpack, i started some example side projects and got it working fine with Backbone, Marionette and Webpack.
Then I went to Disney for a week. When I got back, I did a npm update
and now "Backbone.Marionette" is undefined. For each project! I got one working through various shenanigans of messing with version numbers, but I don't understand what is going on, or how to fix it.
I've boiled it down to a primitive example:
window.$ = require('jquery');
window._ = require('underscore');
var BM = require('backbone.marionette');
console.log(Backbone); // v1.2.3
console.log(Backbone.Marionette); // undefined?!
console.log(BM); // 2.4.4
var App = Backbone.Marionette.Application.extend({});
The require
line pulls in Backbone just fine, but no longer does it define Backbone.Marionette, like it had before. It was working. I can likely get things working by just using that "BM" var, but I'd prefer to understand what happened.
I'm new to this webpack business.
Upvotes: 0
Views: 94
Reputation: 703
I got it to work. I cleared out, entirely, my devDependencies
and dependencies
section of package.json
and removed the ./node_modules
dir. Then I kept running the app, installing any package it happened to be complaining about. Eventually i got to the end of it's complaints, and the stupid thing worked.
It turned out, package.json
had both "backbone" and "backbone.marionette", so at some point, if Backbone.Marionette
had already been initialized, it was evidently initializing Backbone
too, wiping out any previous work.
Upvotes: 1