Open dlespiau opened 5 years ago
es6 is supposed to be able to load modules with cyclic dependencies. The cycle is entirely in our import code, not the v8 one, so maybe, once we break the cycle instead of segfaulting, v8 will be able to load the script.
https://2ality.com/2014/09/es6-modules-final.html#support-for-cyclic-dependencies-between-modules
ResolveModule
has a recursive behaviour: when importing a module, we need to resolve the modules it itself imports.ResolveModule
. path
is the canonical path of an imported module and can be used to track if a module has already been loaded--debug-imports
can be used to trace what's happening in the import code.The thing we want to do here is not to segfault. Supporting cyclic import may start to "just work" once we break cycles.
With:
jk
segfaults trying to resolve an infinite import loop.--debug-imports
can be used to trace what happens, continuously resolving the two imports:We should detect import cycles and stop them before they explode, displaying the cycle for users to debug.