question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack loads 2 versions of backbone instead of 1

See original GitHub issue

When I have a structure like this:

├─┬ node_modules
│ ├── backbone@1.2.1
│ ├─┬ backbone.marionette@2.4.1  
│ │ └─┬ node_modules
│ │   ├── backbone@1.1.2
│ │   └── backbone.babysitter@0.1.7
│ └── backbone.babysitter@0.1.7
└── app.js

And load these modules in my app.js like this:

import Backbone from "backbone";
import Marionette from "backbone.marionette";
import "backbone.babysitter";

Now when I watch in dev tools at the sources tab, it show that the page has loaded 2 backbones and 2 backbone.babysitters. First the self defined versions, and secondly the dependencies of Marionette:

webpack-sources

How can I ensure that webpack provides the self defined packages to Marionette?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
agundermanncommented, Jun 15, 2015

This workaround seems to work well. You probably have to careful about version conflicts though.

module.exports = {
  resolve: {
    alias: {
      'backbone': require.resolve('backbone')
    }
  }
}
0reactions
shamacommented, Jul 2, 2015

This issue can be closed now right @sokra?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use backbone 1.2.0 · Issue #2559 - GitHub
Loading Marionette with Webpack bundles 3 different versions of Backbone and 2 versions of Underscore. backbone.babysitter:.
Read more >
Old Backbone & Marionette built with webpack - Stack Overflow
I'm trying to add "webpack" build to an old project with backbone and ... matter if I load my own backbone, as it...
Read more >
BackboneJS with Webpack: A lesson in optimization
Webpack is a module bundler primary goal is to limit initial loading time. See how to use it, and what it's good for,...
Read more >
Plugins - webpack
Plugins are the backbone of webpack. Webpack itself is built on the same plugin system that you use in your webpack configuration! They...
Read more >
From Require.js to Webpack — Part 2 (The How) - Medium
It wraps the library and exports the value of the Backbone variable. It makes sure that when evaluated backbone has access to both...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found