<p dir="auto">A lot of package maintainers are using the modular <code class="notranslate">lodash-node</code> instead of full-fledged <code class="notranslate">lodash</code> in their projects to cut down on file size. With <code class="notranslate">lodash-node</code>, they can import single functions rather than the entire module. This is nice in some instances, but leads to a lot of duplication if one project uses full-fledged <code class="notranslate">lodash</code> and another uses <code class="notranslate">lodash-node</code>.</p>
<p dir="auto">What I'm wondering is this - is there a way I can use one of the Plugins to replace <code class="notranslate">lodash-node</code> requires with properties on the <code class="notranslate">lodash</code> object? I'm looking for something like:</p>
<p dir="auto"><code class="notranslate">ReplacePlugin('lodash-node/modern/collections/forEach', 'lodash.forEach')</code></p>
<p dir="auto">Or even better:</p>
<p dir="auto"><code class="notranslate">ReplacePlugin(/lodash-node\/modern\/collections\/(.*)(?:\.js)?$/, 'lodash.$1')</code>.</p>
<p dir="auto">Modules will not be moved into entry chunks, but they may be duplicate and should be moved. An option is a leftover chunk. The leftover chunk is a chunk loaded after the entry chunk (async), while the leftover chunk is being loaded no other chunk will be loaded. So modules could be moved into the leftover chunk without introducing an additional loading time.</p>
<p dir="auto">The performance win may be very small and prefecting is the better option.</p>
<p dir="auto">I list it here, because GWT has this kind of behavior...</p>