Jamie Curtis
Jamie Curtis

Reputation: 916

Webpack creating duplicate entries for dependencies

I am trying to switch from using browserify to webpack. One thing browserify handled nicely was dependency management inside dependencies. Let me give an example:

Main app project:

var util1 = require('shared-components/util1');
var util2 = require('shared-components/util2');

Inside shared-components/util1.js

var util2 = require('../util2');

Browserify would realize that the reference to util2 in both scenarios was the same but it appears that Webpack does not which creates duplicate entries for util2.

Is there a configuration setting or plugin I can use to resolve this?

Upvotes: 1

Views: 2091

Answers (1)

Try new webpack.optimize.DedupePlugin(). See the docs for more info.

Upvotes: 1

Related Questions