added circular reference detection on webpack build

This commit is contained in:
2022-03-08 14:25:53 +01:00
parent c8115f4288
commit 2ebf074816
3 changed files with 23 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ const ESLintPlugin = require('eslint-webpack-plugin');
const ExtraneousFileCleanupPlugin = require('webpack-extraneous-file-cleanup-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin')
const utils = require('./utils')
@@ -13,6 +14,8 @@ const langPath = 'web/sites/default/files/lang'
const isDev = process.env.NODE_ENV === 'development';
module.exports = {
resolve: {
extensions: ['.js', '.vue', '.json'],
@@ -172,5 +175,18 @@ module.exports = {
* See `Options and Defaults` for information
*/
new CleanWebpackPlugin(),
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /a\.js|node_modules/,
// include specific files based on a RegExp
// include: /dir/,
// add errors to webpack instead of warnings
failOnError: false,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: false,
// set the current working directory for displaying module paths
// cwd: process.cwd(),
})
]
}