-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.plugins.js
29 lines (24 loc) · 1.02 KB
/
webpack.plugins.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const webpack = require('webpack');
const CircularDependencyPlugin = require('circular-dependency-plugin')
module.exports = {
plugins: [
// new webpack.IgnorePlugin(/\/something$/),
new CircularDependencyPlugin({
// `onStart` is called before the cycle detection starts
onStart({ compilation }) {
console.log('start detecting webpack modules cycles');
},
// `onDetected` is called for each module that is cyclical
onDetected({ module: webpackModuleRecord, paths, compilation }) {
// `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
if (paths[0].indexOf('node_modules/') === 0) return; // ignore node_modules
compilation.errors.push(new Error(paths.join(' -> ')))
},
// `onEnd` is called before the cycle detection ends
onEnd({ compilation }) {
console.log('end detecting webpack modules cycles');
},
}),
]
};