webpack-hash
v0.0.1
Published
Enable webpack to generate file hash based only on content, rather than path.
Downloads
34
Maintainers
Readme
Webpack Hash
A simple Webpack plugin that changes how files are hashed. Webpack hashes are generated based on file content and file location. If your deploy environment has unpredictable file locations (e.g. a date-based folder structure), this produces inconsistent hashes for the same files.
This plugin will produce consistent file hashes, regardless of where the files are located.
Installation
npm install webpack-hash
Usage
This plugin expects to be paired with chunkhash
, and it will generate a unique hash per named chunk. It's recommended that you exclude this plugin from your dev environment. Currently, the plugin uses md5 hash, and offers no configuration options.
// webpack.config.js
// Include the hash plugin
var HashPlugin = require('webpack-hash');
// ... More webpack stuff here ...
// Later, assuming env is a variable holding your build environment
if (env !== 'dev') {
config.plugins.push(new RevPlugin());
}
License
MIT