Webpack creating duplicate entries for dependencies

落花浮王杯 提交于 2019-12-24 14:27:39

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/31412009/webpack-creating-duplicate-entries-for-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!