I recently did an npm install on my webpack/backbone/marionette project and everything broke. I now keep getting this error when I application runs:
Uncaught TypeError: Cannot read property 'radio' of undefined
backbone.marionette.js line 3328
this.channel = _.result(this, 'channel') || Backbone.Wreqr.radio.channel(this.channelName);
Backbone: 1.2.3 (I also tried the brand new version from today of 1.3.1)
Marionette: 2.4.4
Webpack: 1.12.14
I thankfully had a backup of my old node_modules and noticed this difference in the marionette library folder structure.
Any idea what's going on? I hadn't touched my package.json I just re-ran npm install with what it seems like a new version of npm/node.
UPDATE I found this thread where at least one person had the exact same issue but I still don't have a solution https://github.com/marionettejs/backbone.marionette/issues/2559
I solved this problem by add a alias in my webpack configure file.
alias: {
backbone: path.join(__dirname, 'node_modules', 'backbone', 'backbone')
}
I noticed that webpack packs multiple copy of backbone.js in its output file if without alias.
Helped to set deps in package.json
to:
"dependencies": {
"backbone.marionette": "^2.4.4",
"jquery": "^2.2.1",
"underscore": "^1.8.3"
}
(removed backbone dep completely)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With