From d2d88b825c17a7ccf8e12b8f126ba4316904f755 Mon Sep 17 00:00:00 2001 From: Darren Scerri Date: Wed, 22 Nov 2017 22:42:46 +0100 Subject: [PATCH 1/4] Warn about duplicate dependencies --- packages/react-scripts/config/webpack.config.dev.js | 5 +++++ packages/react-scripts/config/webpack.config.prod.js | 5 +++++ packages/react-scripts/package.json | 1 + 3 files changed, 11 insertions(+) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 9f3131b0660..04df5ee7faf 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -17,6 +17,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); +const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const getClientEnvironment = require('./env'); const paths = require('./paths'); @@ -268,6 +269,10 @@ module.exports = { // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // You can remove this if you don't use Moment.js: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + + // Warn about duplicate dependencies. + // See https://github.com/facebookincubator/create-react-app/issues/1844 + new DuplicatePackageCheckerPlugin(), ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 3b2a2068db2..9923f7a67f7 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -18,6 +18,7 @@ const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); const eslintFormatter = require('react-dev-utils/eslintFormatter'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); +const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const paths = require('./paths'); const getClientEnvironment = require('./env'); @@ -356,6 +357,10 @@ module.exports = { // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // You can remove this if you don't use Moment.js: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + + // Warn about duplicate dependencies. + // See https://github.com/facebookincubator/create-react-app/issues/1844 + new DuplicatePackageCheckerPlugin(), ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index f6bff1deaa6..5da6579d4de 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -33,6 +33,7 @@ "css-loader": "0.28.7", "dotenv": "4.0.0", "dotenv-expand": "4.0.1", + "duplicate-package-checker-webpack-plugin": "^2.1.0", "eslint": "4.10.0", "eslint-config-react-app": "^2.0.1", "eslint-loader": "1.9.0", From 5f3eacfd02f539d2e290bf8f2374b61c80020e60 Mon Sep 17 00:00:00 2001 From: Darren Scerri Date: Wed, 22 Nov 2017 23:08:03 +0100 Subject: [PATCH 2/4] Bump prop-types due to duplicate package warning during tests --- .../fixtures/kitchensink/.template.dependencies.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json index b8500f804b1..f3fac6155ab 100644 --- a/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json +++ b/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json @@ -7,7 +7,7 @@ "jsdom": "9.8.3", "mocha": "3.2.0", "normalize.css": "7.0.0", - "prop-types": "15.5.6", + "prop-types": "^15.6.0", "test-integrity": "1.0.0" } } From 0b5450cba686a3dd6c71f1fb901cf792005eeee0 Mon Sep 17 00:00:00 2001 From: Darren Scerri Date: Wed, 10 Jan 2018 23:34:42 +0100 Subject: [PATCH 3/4] Non-strict duplicate package check --- packages/react-scripts/config/webpack.config.dev.js | 2 +- packages/react-scripts/config/webpack.config.prod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 04df5ee7faf..056ea2f02cd 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -272,7 +272,7 @@ module.exports = { // Warn about duplicate dependencies. // See https://github.com/facebookincubator/create-react-app/issues/1844 - new DuplicatePackageCheckerPlugin(), + new DuplicatePackageCheckerPlugin({ strict: false }), ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 9923f7a67f7..a351db6b796 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -360,7 +360,7 @@ module.exports = { // Warn about duplicate dependencies. // See https://github.com/facebookincubator/create-react-app/issues/1844 - new DuplicatePackageCheckerPlugin(), + new DuplicatePackageCheckerPlugin({ strict: false }), ], // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. From 0be2ba03682ee1404c32e2ecea4436a7c6a7f2ef Mon Sep 17 00:00:00 2001 From: Darren Scerri Date: Thu, 11 Jan 2018 08:05:41 +0100 Subject: [PATCH 4/4] pin version --- packages/react-scripts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 5da6579d4de..0959f27564c 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -33,7 +33,7 @@ "css-loader": "0.28.7", "dotenv": "4.0.0", "dotenv-expand": "4.0.1", - "duplicate-package-checker-webpack-plugin": "^2.1.0", + "duplicate-package-checker-webpack-plugin": "2.1.0", "eslint": "4.10.0", "eslint-config-react-app": "^2.0.1", "eslint-loader": "1.9.0",