diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 48e8a7f5c8a..1e666704bf9 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -16,6 +16,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin'); var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); +var DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); var getClientEnvironment = require('./env'); var paths = require('./paths'); @@ -228,6 +229,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 158ac80ea4f..43cb1d3f304 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -16,6 +16,7 @@ var HtmlWebpackPlugin = require('html-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ManifestPlugin = require('webpack-manifest-plugin'); var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); +var DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); var paths = require('./paths'); var getClientEnvironment = require('./env'); @@ -263,6 +264,9 @@ module.exports = { screw_ie8: true } }), + // Warn about duplicate dependencies. + // See https://github.com/facebookincubator/create-react-app/issues/1844 + new DuplicatePackageCheckerPlugin(), // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`. new ExtractTextPlugin(cssFilename), // Generate a manifest file which contains a mapping of all asset filenames diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index ea55505b60c..f5711d72c49 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -37,6 +37,7 @@ "css-loader": "0.26.1", "detect-port": "1.1.1", "dotenv": "2.0.0", + "duplicate-package-checker-webpack-plugin": "^1.2.4", "eslint": "3.16.1", "eslint-config-react-app": "^0.6.2", "eslint-loader": "1.6.0",