I searched the docs but couldn't find clear answer to this.
For example, somewhere in the code I have require(foo), where foo is a variable and so its value is not known at compile time. But say I do know that in my application the value of foo can only be "bar1" or "bar2". If I build the bundle as is, the modules "bar1" and "bar2" will not be included because they are not explicitly referenced. Is it possible to specify in webpack config to include these modules into the bundle (even though they are not referenced), so that at runtime the statement require(foo) will work, as long as the value of foo is "bar1" or "bar2"?
I understand that there is a simple workaround, by including somewhere in the code something like:
const bar1 = require("bar1");
const bar2 = require("bar2");
but was wondering if there is a way to do this via webpack config. Is there way to explicitly include modules into the bundle, knowing that they may/will be used at runtime?