title: How to securely import version from package.json while respecting Error: Should not import the named export 'version'?
body: <p>After updating to Webpack 5, I'm getting this error:</p>
  <blockquote>
  <p>Should not import the named export 'version' (imported as 'version')
  from default-exporting module (only default export is available soon)</p>
  </blockquote>
  <p>Super-simple code example:</p>
  <pre><code>import { version } from '../package.json';
  
  export const appVersion = version;
  </code></pre>
  <p><a href="https://stackoverflow.com/questions/64993118/error-should-not-import-the-named-export-version-imported-as-version">This question</a> gives a solution of <code>import * as packageInfo from '../../package.json'; version: packageInfo.version,</code>, but this imports all of <code>package.json</code>, which, as some of the comments on the answer note, could be considered a security risk.</p>
  <p>All I need is the version number; if I have to import the entire <code>package.json</code> and potentially expose that to my users, it would be better to introduce code duplication and just create and maintain two separate variables:</p>
  <ol>
  <li>the version in <code>package.json</code></li>
  <li>the version in my js app</li>
  </ol>
  <p>However, I am guessing there is a secure way to import <code>package.json</code> without getting Webpack 5 to complain and I just don't know about it.  Is there such a way?</p>