<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">When I using DefinePlugin to inject <code class="notranslate">process.env</code> variable into the package, the output file will contain hundreds of duplicated the variable object (in everywhere the code use it) like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{NODE_ENV:&quot;production&quot;}.NODE_ENV"><pre class="notranslate"><code class="notranslate">{NODE_ENV:"production"}.NODE_ENV
</code></pre></div>
<p dir="auto">Even I activated the <code class="notranslate">--optimize-dedupe</code> argument it still happens.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">Just try this configuration:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="new webpack.DefinePlugin({
	'process.env': JSON.stringify({
		NODE_ENV: process.env.NODE_ENV
	})
})"><pre class="notranslate"><code class="notranslate">new webpack.DefinePlugin({
	'process.env': JSON.stringify({
		NODE_ENV: process.env.NODE_ENV
	})
})
</code></pre></div>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">I am expecting any variable injected by DefinePlugin should only present once in the output code as an internal module. And when any usage of the variables it could just be like a requirement.</p>
<p dir="auto">Because if it act like current, the size of output file will be very huge with several injected variables.</p>
<p dir="auto">Hope you could help on this.</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong><br>
If i use babel-transform-runtime and use optimization splitChunks app.bundle.js not start in browser.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="clone https://github.com/ariran5/webpack-splitting-error"><pre class="notranslate"><code class="notranslate">clone https://github.com/ariran5/webpack-splitting-error
</code></pre></div>
<p dir="auto">open index.html in dist<br>
or</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="clone https://github.com/ariran5/webpack-splitting-error
cd webpack-splitting-error
npm i
npm run webpack"><pre class="notranslate"><code class="notranslate">clone https://github.com/ariran5/webpack-splitting-error
cd webpack-splitting-error
npm i
npm run webpack
</code></pre></div>
<p dir="auto">and open index.html in dist</p>
<p dir="auto">in order for this to work, you need to remove optimization in webpack config</p>






<p dir="auto"><strong>What is the expected behavior?</strong><br>
JavaScript is expected to start working</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  4.16.5<br>
Node.js version: 10.8<br>
Operating System: windows 10<br>
Additional tools:</p>