Webpack creating duplicate dependency entries

I am trying to switch from using a browser to a web package. One thing the browser has been good at looking at is the management of dependencies within dependencies. Let me give an example:

The main project of the application:

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

Inside shared-components / util1.js

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

Browserify will understand that the reference to util2 is the same in both scenarios, but Webpack does not seem to create duplicate entries for util2.

Is there a configuration option or plugin that I can use to solve this problem?

+1
javascript webpack browserify
source share
1 answer

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

+1
source share

All Articles