Sometimes you want to know project dependencies exact versions on production environment.
npm install --save-dev package-version-plugin
var PackageVersionPlugin = require('package-version-plugin');
var webpackConfig = {
plugins: [
new PackageVersionPlugin({
registry: "https://registry.npmjs.org/",
outputFile: "test-version.html",
name: "test",
showDevDependencies:true,
showDependencies:true,
depFilterRegExp:/^test/,
devDepFilterRegExp:/^\test/
})
]
}
const PackageVersionPlugin = require('package-version-plugin');
...
chainWebpack:config =>{
config.plugin("PackageVersionPlugin").use(PackageVersionPlugin, [
{
registry: "https://registry.npmjs.org/",
outputFile: "test-version.html",
name: "test",
showDevDependencies:true,
showDependencies:true,
depFilterRegExp:/^test/,
devDepFilterRegExp:/^\test/
}
]);
}
...
Plugin will collect dependencies version list and output version.json
in the webpack bundle path