How do you traverse the Webpack module graph without `module.reasons`?

Viewed 64

In Webpack 5, module.reasons was removed (see: https://webpack.js.org/blog/2020-10-10-webpack-5-release/). From what I have been able to find, the documentation doesn't list an alternative. Documentation for the module graph is also pretty scarce.

We have build code that currently checks module.reasons inside of the splitChunksPlugin test() function. That code breaks in Webpack 5.

Does anyone know what the replacement for module.reasons is? I've tried looking stuff up in the module graph but I don't think the current module has been added yet because it is always undefined when calling getModule() on the graph.

0 Answers
Related