-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.plugins.js
27 lines (23 loc) · 1.07 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
const webpack = require('webpack');
const CircularDependencyPlugin = require('circular-dependency-plugin')
module.exports = [
// new webpack.IgnorePlugin(/\/something$/), // Ignore something
// new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // Ignore Moment's locale
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/') > -1) 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');
},
}),
];