Skip to content

Commit d2d88b8

Browse files
committed
Warn about duplicate dependencies
1 parent a03524c commit d2d88b8

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
1717
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
1818
const eslintFormatter = require('react-dev-utils/eslintFormatter');
1919
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
20+
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
2021
const getClientEnvironment = require('./env');
2122
const paths = require('./paths');
2223

@@ -268,6 +269,10 @@ module.exports = {
268269
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
269270
// You can remove this if you don't use Moment.js:
270271
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
272+
273+
// Warn about duplicate dependencies.
274+
// See https://github.com/facebookincubator/create-react-app/issues/1844
275+
new DuplicatePackageCheckerPlugin(),
271276
],
272277
// Some libraries import Node modules but don't use them in the browser.
273278
// Tell Webpack to provide empty mocks for them so importing them works.

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
1818
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
1919
const eslintFormatter = require('react-dev-utils/eslintFormatter');
2020
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
21+
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
2122
const paths = require('./paths');
2223
const getClientEnvironment = require('./env');
2324

@@ -356,6 +357,10 @@ module.exports = {
356357
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
357358
// You can remove this if you don't use Moment.js:
358359
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
360+
361+
// Warn about duplicate dependencies.
362+
// See https://github.com/facebookincubator/create-react-app/issues/1844
363+
new DuplicatePackageCheckerPlugin(),
359364
],
360365
// Some libraries import Node modules but don't use them in the browser.
361366
// Tell Webpack to provide empty mocks for them so importing them works.

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"css-loader": "0.28.7",
3434
"dotenv": "4.0.0",
3535
"dotenv-expand": "4.0.1",
36+
"duplicate-package-checker-webpack-plugin": "^2.1.0",
3637
"eslint": "4.10.0",
3738
"eslint-config-react-app": "^2.0.1",
3839
"eslint-loader": "1.9.0",

0 commit comments

Comments
 (0)