dagre icon indicating copy to clipboard operation
dagre copied to clipboard

Fixed a require bug in graphlib.js

Open TimMouskhelichvili opened this issue 5 years ago • 4 comments

Fixed bug Uncaught TypeError: Cannot read property 'preorder' of undefined.

TimMouskhelichvili avatar Nov 15 '19 20:11 TimMouskhelichvili

This would be a great fix, to avoid having to patch dagre in node_modules.

brianmhunt avatar May 11 '20 17:05 brianmhunt

Is there an issue providing some context and repro steps?

lutzroeder avatar May 11 '20 19:05 lutzroeder

Essentially we've a project compiling Typescript with Webpack + Babel, and without the /index it errors on the require statement.

@ctcarton Do you have any additional details that might help give more context?

brianmhunt avatar May 11 '20 21:05 brianmhunt

After some investigation I've found that the module redirection that dagre is using here is confusing webpack. The simple solution I've found is to update webpack.config.js with a resolve alias which forces always using the version of graphlib in node_modules.

In module.exports in webpack.config.js:

    resolve: {
        alias: {
            "graphlib": "node_modules/graphlib"
        },
    }

ctcarton avatar May 13 '20 12:05 ctcarton