From 70699fc711bc6f63dfcb864c49f89aeb62e29e58 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 5 Aug 2021 15:30:03 +0800 Subject: [PATCH] chore: add duplicate-package-checker-webpack-plugin (#31662) * chore: fix deps * test: add duplicate-package-checker-webpack-plugin * test: should be broken * try webpack --bail * bail when emit error * revert rc-image --- .antd-tools.config.js | 7 ++++++- package.json | 9 +++++---- webpack.config.js | 8 ++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.antd-tools.config.js b/.antd-tools.config.js index b721859d39..6a229451ca 100644 --- a/.antd-tools.config.js +++ b/.antd-tools.config.js @@ -22,7 +22,11 @@ function finalizeCompile() { fs.readdir(componentsPath, (err, files) => { files.forEach(file => { if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { - componentsLessContent += `@import "../${path.posix.join(file, 'style', 'index.less')}";\n`; + componentsLessContent += `@import "../${path.posix.join( + file, + 'style', + 'index.less', + )}";\n`; } }); fs.writeFileSync( @@ -129,4 +133,5 @@ module.exports = { finalize: finalizeDist, }, generateThemeFileContent, + bail: true, }; diff --git a/package.json b/package.json index de3eb4e2da..68cdf851ba 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "rc-drawer": "~4.3.0", "rc-dropdown": "~3.2.0", "rc-field-form": "~1.20.0", - "rc-image": "~5.2.4", + "rc-image": "~5.2.5", "rc-input-number": "~7.1.0", "rc-mentions": "~1.6.1", "rc-menu": "~9.0.12", @@ -148,13 +148,13 @@ "rc-trigger": "^5.2.1", "rc-upload": "~4.3.0", "rc-util": "^5.13.1", - "scroll-into-view-if-needed": "^2.2.25", - "warning": "^4.0.3" + "scroll-into-view-if-needed": "^2.2.25" }, "devDependencies": { "@ant-design/bisheng-plugin": "^2.3.0", "@ant-design/hitu": "^0.0.0-alpha.13", - "@ant-design/tools": "^13.6.0", + "@ant-design/tools": "^13.6.2", + "@docsearch/css": "^1.0.0-alpha.22", "@docsearch/react": "^3.0.0-alpha.37", "@qixian.cs/github-contributors-list": "^1.0.3", "@stackblitz/sdk": "^1.3.0", @@ -192,6 +192,7 @@ "cross-env": "^7.0.0", "dekko": "^0.2.1", "docsearch.js": "^2.6.3", + "duplicate-package-checker-webpack-plugin": "^3.0.0", "enquire-js": "^0.2.1", "enzyme": "^3.10.0", "enzyme-to-json": "^3.6.0", diff --git a/webpack.config.js b/webpack.config.js index 620d23abc8..b86ee12636 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,6 +4,7 @@ const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { ESBuildMinifyPlugin } = require('esbuild-loader'); +const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin'); const darkVars = require('./scripts/dark-vars'); const compactVars = require('./scripts/compact-vars'); @@ -112,6 +113,13 @@ if (process.env.RUN_ENV === 'PRODUCTION') { reportFilename: '../report.html', }), ); + + config.plugins.push( + new DuplicatePackageCheckerPlugin({ + verbose: true, + emitError: true, + }), + ); }); processWebpackThemeConfig(webpackDarkConfig, 'dark', darkVars);