gloriaJun / til

Lessoned Learned
3 stars 0 forks source link

circular-dependency-plugin #82

Open gloriaJun opened 4 years ago

gloriaJun commented 4 years ago

Reference

 new CircularDependencyPlugin({
      // exclude detection of files based on a RegExp
      exclude: /a\.js|node_modules/,
      // `onStart` is called before the cycle detection starts
      onStart() {
        console.log('start detecting webpack modules cycles');
      },
      // `onDetected` is called for each module that is cyclical
      onDetected({ 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
        compilation.errors.push(new Error(paths.join(' -> ')));
      },
      // `onEnd` is called before the cycle detection ends
      onEnd() {
        console.log('end detecting webpack modules cycles');
      },
    }),