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

javascript - Why Selenium can't find an element that is graphically visible -

java - How to compare two classes -

mysql - Gateway Timeout Error on Insert 70000 record using Hibernate in Java -