If you work with JavaScript, or you've ever interacted with a JavaScript project, Node.js or a frontend project, you surely met the package.json
file.
In the JavaScript application under package.json file, you can see the one property called version. We can use this version while deploying to indicate the different versions of the application.
in WebPack 4 the version can be accessed in our application by simply importing this file as below:
import { version } from '../../package';
After migration to WebPack 5 The version can be accessed in our application by simply importing this file as below:
import packageInfo from 'package.json';
export default packageInfo.version;
Top comments (0)