webpack - How to use ContextReplacementPlugin on a require wrapped in a loop -


i'm trying use contextreplacementplugin resolve dynamic requires occurring in loop: https://github.com/mongodb/js-bson/blob/master/lib/bson/index.js#l7-l24

here's code:

[ './binary_parser'   , './binary'   , './code'   , './map'   , './db_ref'   , './double'   , './max_key'   , './min_key'   , './objectid'   , './regexp'   , './symbol'   , './timestamp'   , './long'].foreach(function (path) {     var module = require(path);     (var in module) {         exports[i] = module[i];     } }); 

i'm having trouble constructing source regex match this. path being matched against source seems ".". moreover, context plugin seems called once when there 13 files being required in loop. can contextreplacementplugin used resolve issue or should try else?


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -