Add webpack plugin to check duplicate deps

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2021-05-03 16:33:46 +02:00
parent 7b2015c3bd
commit 7a4a4b591c
3 changed files with 30 additions and 3 deletions

View File

@ -10,7 +10,8 @@
"test": "echo \"no tests yet\"",
"develop": "webpack serve --config webpack.config.dev.js --progress profile",
"develop:ce": "STRAPI_DISABLE_EE=true webpack serve --config webpack.config.dev.js --progress profile",
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js"
"analyze:bundle": "ANALYZE_BUNDLE=true webpack --config webpack.config.dev.js",
"analyze:deps": "ANALYZE_DEPS=true webpack serve --config webpack.config.dev.js --progress profile"
},
"main": "index.js",
"dependencies": {
@ -131,6 +132,7 @@
"license": "SEE LICENSE IN LICENSE",
"gitHead": "231263a3535658bab1e9492c6aaaed8692d62a53",
"devDependencies": {
"duplicate-dependencies-webpack-plugin": "0.2.0",
"webpack-bundle-analyzer": "4.4.1"
}
}

View File

@ -2,10 +2,13 @@
const path = require('path');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const { DuplicateReporterPlugin } = require('duplicate-dependencies-webpack-plugin');
const webpackConfig = require('./webpack.config.js');
module.exports = () => {
const analyzeBundle = process.env.ANALYZE_BUNDLE;
const analyzeDuplicateDependencies = process.env.ANALYZE_DEPS;
const entry = path.join(__dirname, 'admin', 'src', 'app.js');
const dest = path.join(__dirname, 'build');
@ -32,6 +35,10 @@ module.exports = () => {
config.plugins.push(new BundleAnalyzerPlugin());
}
if (analyzeDuplicateDependencies === 'true') {
config.plugins.push(new DuplicateReporterPlugin());
}
return {
...config,
devServer: {

View File

@ -7800,6 +7800,19 @@ duplexify@^3.4.2, duplexify@^3.5.0, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"
duplicate-dependencies-webpack-plugin@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/duplicate-dependencies-webpack-plugin/-/duplicate-dependencies-webpack-plugin-0.2.0.tgz#3fd5b5c310c1f6ea16c3ba5b73f34f420697be60"
integrity sha512-qeyxzZApFEwD2JONAUNEojHYkjxeXkJdJ+X9g67geYmMddb1SaWRCDRA/FmQTxHsHvebMwmUVxSMguRjyloCPw==
dependencies:
boxen "^4.2.0"
chalk "^3.0.0"
is-path-inside "^3.0.2"
pretty-bytes "^5.3.0"
string-width "^4.2.0"
tapable "^1.1.3"
text-table "^0.2.0"
ecc-jsbn@~0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9"
@ -11129,7 +11142,7 @@ is-path-inside@^2.1.0:
dependencies:
path-is-inside "^1.0.2"
is-path-inside@^3.0.1:
is-path-inside@^3.0.1, is-path-inside@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
@ -16016,7 +16029,7 @@ prettier@^1.18.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
pretty-bytes@^5.1.0:
pretty-bytes@^5.1.0, pretty-bytes@^5.3.0:
version "5.6.0"
resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.6.0.tgz#356256f643804773c82f64723fe78c92c62beaeb"
integrity sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==
@ -19489,6 +19502,11 @@ table@^6.0.4, table@^6.0.7:
slice-ansi "^4.0.0"
string-width "^4.2.0"
tapable@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2"
integrity sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==
tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b"