Reputation: 613
During the execution of the webpack build I would like to get the webpack version. I need this info to make build preparations based on webpack 4 or webpack 5.
Intention: to prepare the project for an upgrade from webpack 4 to 5 I am not allowed to make this specific step myself. At some point the company build runner updates webpack.
I know that webpack has a command for it: npx webpack --version
. How to access the version from within the build config?
Upvotes: 0
Views: 449
Reputation: 613
To access the webpack version from within the build config it is possible to load webpack as a dependency and check its version property:
const { version } = require('webpack');
Upvotes: 1