diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index aea37eab6bc..3cb87711f51 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -16,6 +16,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); +const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const getClientEnvironment = require('./env'); const paths = require('./paths'); @@ -236,6 +237,9 @@ module.exports = { // a plugin that prints an error when you attempt to do this. // See https://github.com/facebookincubator/create-react-app/issues/240 new CaseSensitivePathsPlugin(), + // Warn about duplicate dependencies. + // See https://github.com/facebookincubator/create-react-app/issues/1844 + new DuplicatePackageCheckerPlugin(), // If you require a missing module and then `npm install` it, you still have // to restart the development server for Webpack to discover it. This plugin // makes the discovery automatic so you don't have to restart. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 218eb46bb0c..6fca17e8c1f 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -16,6 +16,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); +const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const paths = require('./paths'); const getClientEnvironment = require('./env'); @@ -274,6 +275,9 @@ module.exports = { new ExtractTextPlugin({ filename: cssFilename, }), + // Warn about duplicate dependencies. + // See https://github.com/facebookincubator/create-react-app/issues/1844 + new DuplicatePackageCheckerPlugin(), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without // having to parse `index.html`. diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index b2cb03bb972..84bc9ed3df8 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -35,6 +35,7 @@ "css-loader": "0.26.2", "detect-port": "1.1.0", "dotenv": "2.0.0", + "duplicate-package-checker-webpack-plugin": "^1.2.3", "eslint": "3.16.1", "eslint-config-react-app": "^0.6.1", "eslint-loader": "1.6.3",