It looks to me like the bundling of a dynamic require attempts to bundle every file in the package, in case thats the file that is dynamically required. In this case i’m getting stuff like:
Module parse failed: /home/vagrant/backend/node_modules/colors/MIT-LICENSE.txt
Module parse failed: /home/vagrant/backend/node_modules/colors/example.html
Clearly files that would never be required via a dynamic require. In fact, tho, I’m not even using the function that contains the dynamic require. It would be nice if webpack could somehow detect that fact, and remove it from the bundle. Doing this kind of pruning would give a lot of efficiency gains in fact.
What are some ways to work around this?