如何在webpack.config.js中访问哈希值

时间:2016-05-25 10:32:26

标签: webpack webpack-dev-server

访问webpack.config.js中的哈希值

//Sample webpack.config.js File  

var webpack = require('webpack');

console.log("[hash]");//How to access hash value??

1 个答案:

答案 0 :(得分:3)

您可以通过hash访问stats。演示:

webpack({
    ...
}, function(err, stats) {
    if(err) {
        return console.error(err);
    }

    console.log(stats.hash);
});