How to fix nasty circular dependency issues once and for all in JavaScript & TypeScript
Michel Weststrate

Great explanation, but I think introducing ‘internal’ might have performance issue with webpack and es6 modules. For example, if we only want to use “AbstractNode” in our index.js, originally we could just import AbstractNode from AbstractNode.js, so webpack would only compile the file AbstractNode.js;

But after using internal.js, webpack will first parse ‘internal.js’, and then parse all files exported in the ‘internal.js’, in this case ‘AbstractNode.js’ ‘Leaf.js’, ‘Node.js’. The last two are redundant and may have big performance issues if project is big and there are many exports in internal.js.