aackerman / circular-dependency-plugin

Detect circular dependencies in modules compiled with Webpack
https://www.npmjs.com/package/circular-dependency-plugin
ISC License
914 stars 46 forks source link

TypeError: plugin.options.include.test is not a function #84

Closed leopucci closed 2 years ago

leopucci commented 2 years ago

Having some trouble configuring this plugin to work on the code!

leopucci commented 2 years ago

https://github.com/aackerman/circular-dependency-plugin/issues/41

leopucci commented 2 years ago

Seems that the path that i configured was wrong. I inserted a path string but it was a regexp. BTW did not detected anything on first config, I had to add the advanced mode

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
        compilation.errors.push(new Error(paths.join(' -> ')));
      },
      // `onEnd` is called before the cycle detection ends
      onEnd({ compilation }) {
        console.log('end detecting webpack modules cycles');
      },

Then printed the circular dependency