English | 中文
Vendor Vesion is a plugin for webpack5
, shows dependencies version info by insert a comment in your compiled code.
Such as:
/** Your Name build at 2022-05-17 14:57:45 , version info : {"react":"16.8.0","lodash":"4.17.21"} */
// ... you compiled code here
npm install --save-dev verdor-version
edit your webpack.config.js
file :
const VerdorVersionPlugin = require('verdor-version');
module.exports = {
...
plugins: [new VerdorVersionPlugin()],
}
constructor support a object type param, specify some future of the comment:
field | description | default |
---|---|---|
footer | boolean the comment position, true:foot,false:head |
false |
banner | string custom a string in the commment, will show before the version info. ATTENTION this string not safe , not use like "**/" to block the commont code. |
null |
dependencies | string[] what dependencies version will show on the code. |
use package.json -> dependencies in your project |
variable | string in webpack production mode, use a variable instead of comment. |
"_v_v" |
Demo:
const VerdorVersionPlugin = require('verdor-version');
module.exports = {
...
plugins: [new VerdorVersionPlugin({
banner:'My Name',
// footer: true,
dependencies:['lodash','react']
})],
}