Browse Source

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
pull/31688/head
afc163 3 years ago
committed by GitHub
parent
commit
70699fc711
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .antd-tools.config.js
  2. 9
      package.json
  3. 8
      webpack.config.js

7
.antd-tools.config.js

@ -22,7 +22,11 @@ function finalizeCompile() {
fs.readdir(componentsPath, (err, files) => { fs.readdir(componentsPath, (err, files) => {
files.forEach(file => { files.forEach(file => {
if (fs.existsSync(path.join(componentsPath, file, 'style', 'index.less'))) { 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( fs.writeFileSync(
@ -129,4 +133,5 @@ module.exports = {
finalize: finalizeDist, finalize: finalizeDist,
}, },
generateThemeFileContent, generateThemeFileContent,
bail: true,
}; };

9
package.json

@ -124,7 +124,7 @@
"rc-drawer": "~4.3.0", "rc-drawer": "~4.3.0",
"rc-dropdown": "~3.2.0", "rc-dropdown": "~3.2.0",
"rc-field-form": "~1.20.0", "rc-field-form": "~1.20.0",
"rc-image": "~5.2.4", "rc-image": "~5.2.5",
"rc-input-number": "~7.1.0", "rc-input-number": "~7.1.0",
"rc-mentions": "~1.6.1", "rc-mentions": "~1.6.1",
"rc-menu": "~9.0.12", "rc-menu": "~9.0.12",
@ -148,13 +148,13 @@
"rc-trigger": "^5.2.1", "rc-trigger": "^5.2.1",
"rc-upload": "~4.3.0", "rc-upload": "~4.3.0",
"rc-util": "^5.13.1", "rc-util": "^5.13.1",
"scroll-into-view-if-needed": "^2.2.25", "scroll-into-view-if-needed": "^2.2.25"
"warning": "^4.0.3"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/bisheng-plugin": "^2.3.0", "@ant-design/bisheng-plugin": "^2.3.0",
"@ant-design/hitu": "^0.0.0-alpha.13", "@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", "@docsearch/react": "^3.0.0-alpha.37",
"@qixian.cs/github-contributors-list": "^1.0.3", "@qixian.cs/github-contributors-list": "^1.0.3",
"@stackblitz/sdk": "^1.3.0", "@stackblitz/sdk": "^1.3.0",
@ -192,6 +192,7 @@
"cross-env": "^7.0.0", "cross-env": "^7.0.0",
"dekko": "^0.2.1", "dekko": "^0.2.1",
"docsearch.js": "^2.6.3", "docsearch.js": "^2.6.3",
"duplicate-package-checker-webpack-plugin": "^3.0.0",
"enquire-js": "^0.2.1", "enquire-js": "^0.2.1",
"enzyme": "^3.10.0", "enzyme": "^3.10.0",
"enzyme-to-json": "^3.6.0", "enzyme-to-json": "^3.6.0",

8
webpack.config.js

@ -4,6 +4,7 @@ const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig');
const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin'); const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { ESBuildMinifyPlugin } = require('esbuild-loader'); const { ESBuildMinifyPlugin } = require('esbuild-loader');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const darkVars = require('./scripts/dark-vars'); const darkVars = require('./scripts/dark-vars');
const compactVars = require('./scripts/compact-vars'); const compactVars = require('./scripts/compact-vars');
@ -112,6 +113,13 @@ if (process.env.RUN_ENV === 'PRODUCTION') {
reportFilename: '../report.html', reportFilename: '../report.html',
}), }),
); );
config.plugins.push(
new DuplicatePackageCheckerPlugin({
verbose: true,
emitError: true,
}),
);
}); });
processWebpackThemeConfig(webpackDarkConfig, 'dark', darkVars); processWebpackThemeConfig(webpackDarkConfig, 'dark', darkVars);

Loading…
Cancel
Save