<p dir="auto">The current watch mode for webpack is fairly good at caching load results and general workload between file changes as long as you keep the same webpack process running. The initial build for some projects, on the other hand, can be on the order of more than a minute. This can make the build process very slow if for some reason you need to stop your watcher, or node crashes, or you simply want to restart your connect server with different flags.</p>
<p dir="auto">It would be nice if webpack were able to persist compilation information between invocations of the node process to the filesystem and reload that cache later -- so ideally, performance between different <code class="notranslate">$ webpack</code> calls would be close to how long it takes to <code class="notranslate">--watch</code> to recompile when it detects a change.</p>
<p dir="auto">I'm sure this has been talked about before, but I can't find a clear issue for it. I'm playing around with using webpack with server-side node modules (using <code class="notranslate">target: node</code>). I started to like the idea of bundling of everything into a single js file because that would be cool for deployment, but what kills that idea is binary dependencies. They definitely can't be bundled in, though you might know of a hack that lets me alias them or something.</p>
<p dir="auto">Is there any way to tell the system ignore bundling anything coming from <code class="notranslate">node_modules</code>, and just leave it as a <code class="notranslate">require</code> statement?</p>
<p dir="auto">I don't know if the <code class="notranslate">IgnorePlugin</code> means that, but if so, trying it results in an error: <code class="notranslate">plugins: [ new webpack.IgnorePlugin(/.*/, /.*node_modules.*/) ]</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% webpack --config webpack.node.config.js

/Users/james/projects/jlongster4/node_modules/webpack/lib/Compilation.js:203
                factory.create(module.context, dependencies[0], function(err, dependantModul
                                     ^
TypeError: Cannot read property 'context' of null
    at Tapable.&lt;anonymous&gt; (/Users/james/projects/jlongster4/node_modules/webpack/lib/Compilation.js:203:24)"><pre class="notranslate"><code class="notranslate">% webpack --config webpack.node.config.js

/Users/james/projects/jlongster4/node_modules/webpack/lib/Compilation.js:203
                factory.create(module.context, dependencies[0], function(err, dependantModul
                                     ^
TypeError: Cannot read property 'context' of null
    at Tapable.&lt;anonymous&gt; (/Users/james/projects/jlongster4/node_modules/webpack/lib/Compilation.js:203:24)
</code></pre></div>