Skip to content

Webpack loads 2 versions of backbone instead of 1 #1165

Closed

Description

@yolandavdvegt

When I have a structure like this:

├─┬ node_modules
│ ├── [email protected]
│ ├─┬ [email protected]  
│ │ └─┬ node_modules
│ │   ├── [email protected]
│ │   └── [email protected]
│ └── [email protected]
└── 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?

Activity

  1. SimenB commented on Jun 15, 2015

    @SimenB
    Contributor

    Did you try npm dedupe? Doesn't help with webpack directly, but it might remove some duplicated deps

  2. agundermann commented on Jun 15, 2015

    @agundermann

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

    module.exports = {
      resolve: {
        alias: {
          'backbone': require.resolve('backbone')
        }
      }
    }
  3. akre54 commented on Jun 15, 2015

    @akre54
    Contributor

    Try running npm dedupe and DedupePlugin.

  4. yolandavdvegt commented on Jun 17, 2015

    @yolandavdvegt
    Author

    @taurose thank you, thats what I needed

  5. shama commented on Jul 2, 2015

    @shama
    Contributor

    This issue can be closed now right @sokra?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions