title: const variable undefined when code/ chunk splitting
body: <p>I have in my project the following vanilla JS files:-</p>
  <ol>
  <li>Main</li>
  <li>Constants</li>
  <li>Game</li>
  </ol>
  <p>Constants JS has a group of exported variables one of which is set via an ENV var which is used by Game JS(not Main).</p>
  <p>On compile( webpack/ babel) the code is split into Main and Game and Main JS lazy loads game on demand.</p>
  <p>My problem is if there is a line in Constants JS <code>export const URL = process.env.VAR</code></p>
  <p>While I can see the variable set in Main JS( which doesn't use it), URL is <strong>undefined</strong> in Game JS( which does use it )</p>
  <p>How is this possible and can you explain what is happening here?</p>
  <p>My webpack config for this is</p>
  <pre><code>,
    entry: {
      main: &quot;./src/main.js&quot;
    },
    output: {
      filename: 'build/[name].js',
      path: path.resolve(__dirname),
      publicPath: 'auto',
      assetModuleFilename: 'assets/[name][ext][query]'
    }
  ,
    optimization: {
        runtimeChunk: 'multiple',
        minimizer: [
          '...',
          new CssMinimizerPlugin()
        ]
    }
  </code></pre>
  <p>in Main JS I do the following</p>
  <pre><code> import(/* webpackChunkName: &quot;game&quot; */ /* webpackPreload: true */ './game').then(module =&gt; {
       const initGame = module.default, ...
  </code></pre>
  <p>Game JS has</p>
  <pre><code>import { URL } from '../constants'
  ...
  
  const initGame = () =&gt; {
  ...
  fetch(URL... 
  
  export default initGame
  </code></pre>