dev: add plugin for circular dependency detection

Example run: https://gist.github.com/saghul/e5e12edc108bdedbcbe65a3d7528235f
This commit is contained in:
Saúl Ibarra Corretgé 2020-05-28 13:28:04 +02:00 committed by Saúl Ibarra Corretgé
parent 3a88f4939c
commit d4d1d0aa70
3 changed files with 15 additions and 0 deletions

6
package-lock.json generated
View File

@ -6169,6 +6169,12 @@
"safe-buffer": "^5.0.1"
}
},
"circular-dependency-plugin": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/circular-dependency-plugin/-/circular-dependency-plugin-5.2.0.tgz",
"integrity": "sha512-7p4Kn/gffhQaavNfyDFg7LS5S/UT1JAjyGd4UqR2+jzoYF02eDkj0Ec3+48TsIa4zghjLY87nQHIh/ecK9qLdw==",
"dev": true
},
"circular-json": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",

View File

@ -110,6 +110,7 @@
"@babel/runtime": "7.5.5",
"babel-eslint": "10.0.1",
"babel-loader": "8.0.4",
"circular-dependency-plugin": "5.2.0",
"clean-css": "3.4.25",
"css-loader": "0.28.7",
"eslint": "5.6.1",

View File

@ -1,5 +1,6 @@
/* global __dirname */
const CircularDependencyPlugin = require('circular-dependency-plugin');
const process = require('process');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
@ -11,6 +12,7 @@ const devServerProxyTarget
= process.env.WEBPACK_DEV_SERVER_PROXY_TARGET || 'https://alpha.jitsi.net';
const analyzeBundle = process.argv.indexOf('--analyze-bundle') !== -1;
const detectCircularDeps = process.argv.indexOf('--detect-circular-deps') !== -1;
const minimize
= process.argv.indexOf('-p') !== -1
@ -155,6 +157,12 @@ const config = {
&& new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
generateStatsFile: true
}),
detectCircularDeps
&& new CircularDependencyPlugin({
allowAsyncCycles: false,
exclude: /node_modules/,
failOnError: false
})
].filter(Boolean),
resolve: {