aGoodRussianGuy aGoodRussianGuy - 11 days ago 4
Javascript Question

How to find modules in subfolder webpack?

Is there a way to set up webpack to find modules in subfolders like

./components/*/
?

Answer

You are looking for the config option resolve.modulesDirectories:

An array of directory names to be resolved to the current directory as well as its ancestors, and searched for modules. This functions similarly to how node finds “node_modules” directories. For example, if the value is ["mydir"], webpack will look in “./mydir”, “../mydir”, “../../mydir”, etc.

Comments