You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in a situation where circular dependencies cannot be avoided altogether, but where some of the require calls can be postponed until the dependent modules are loaded completely. Here's an example:
const b = require('b');
export class a;
let a;
export class b {
constructor() {
a = require('a');
}
};
As far as I can see, your plugin would flag this as a circular dependency, but it shouldn't be a problematic one, as module b could be required before it required a. Do you see any way to prevent warnings/errors for these cases?
The text was updated successfully, but these errors were encountered:
Yea, I would imagine you would use the exclude regex option. There is an example in the README. Please let me know if that isn't enough information to solve this issue.
Yes, I could suppress the warning/error manually for circular dependencies that are not problematic. But my point is that the warning/error shouldn't be there in the first place if the circular dependency chain can be resolved by webpack, i.e., if one of the modules can be loaded because it requires it's successor after it has been loaded completely. Do you see what I mean?
That type of static analysis is not something that can not be provided by this tool. Webpack itself analyzes import and require calls to build a dependency graph and construct a module bundle, it doesn't do any analysis of runtime semantics and this tool doesn't either.
The best this tool can do is identifying circular dependencies, which might identify a problem but requires a human to do further analysis.
I personally don't believe that a tool for JavaScript exists that could error in the way you would expect. Sorry to say I cannot provide this functionality.
Thanks for the plugin!
I'm in a situation where circular dependencies cannot be avoided altogether, but where some of the require calls can be postponed until the dependent modules are loaded completely. Here's an example:
As far as I can see, your plugin would flag this as a circular dependency, but it shouldn't be a problematic one, as module b could be required before it required a. Do you see any way to prevent warnings/errors for these cases?
The text was updated successfully, but these errors were encountered: