@fto-consult/common
Version:
Un ensemble de bibliothèques et d'utilistaires communs pour le développement d'applications javascript
28 lines • 1.27 kB
JavaScript
const CircularDependencyPlugin = require("circular-dependency-plugin");
module.exports = new CircularDependencyPlugin({
exclude: /node_modules/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd(),
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: false,
// `onStart` is called before the cycle detection starts
onStart({ compilation }) {
//console.log('\nstart detecting webpack modules cycles');
},
// `onDetected` is called for each module that is cyclical
onDetected({ module: webpackModuleRecord, paths, compilation }) {
paths.unshift("*** circular dependecies detected ***\n");
if(paths.length){
// `paths` will be an Array of the relative module paths that make up the cycle
// `module` will be the module record generated by webpack that caused the cycle
compilation.errors.push(new Error(paths.join(' -> ')))
//console.log("*** end circulars dependencies ***");
}
},
// `onEnd` is called before the cycle detection ends
onEnd({ compilation }) {
//console.log('\nend detecting webpack modules cycles');
},
});