1.0.0 • Published 3 years ago
vite-plugin-hot-hash v1.0.0
vite-plugin-hot-hash
It is used to obtain all files in the generated dist and generate hash values for each file. In mixed development, it can be used to compare local client and server files to determine whether to update the client's local files, so as to achieve hot update.
📦 Install
# npm
npm i vite-plugin-hot-hash -D
# yarn
yarn add vite-plugin-hot-hash -D
# pnpm
pnpm i vite-plugin-hot-hash -D
🦄 Usage
Add HotHash
plugin to vite.config.js / vite.config.ts
and configure it:
- Use (without parameters)
import HotHash from 'vite-plugin-hot-hash';
// const { HotHash } = require('vite-plugin-hot-hash');
export default {
plugins: [
HotHash()
]
}
- Use (with parameters):Parameters can be customized without restriction
// vite.config.js / vite.config.ts
import HotHash from 'vite-plugin-hot-hash';
// const { HotHash } = require('vite-plugin-hot-hash');
const { version } = require('./package.json');
export default {
plugins: [
HotHash({version })
]
}
Output
{
"lastBuildTDate": "2022-12-05 16:03:33",
"fileInfoList": [
{
"path": "./index.html",
"hash": "384bb358ff5a63dac5296246e40f2a212658d844a5e53f0586f61cd6521a45c2",
"size": 423
},
{
"path": "./js/AboutView.2dff34df.js",
"hash": "afb66283869dc425b6e71af93a352f404780106cb411b5ca31e17a172831ce26",
"size": 294
},
{
"path": "./js/index.4aaec122.js",
"hash": "2f284ad96d502363d91212af7131273b22e6b04ef6519ef08d3edcaf76ed1dce",
"size": 140774
}
],
"version": "1.0.0"
}
License
1.0.0
3 years ago