offline-package-vite-plugin
v2.4.0
Published
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
Downloads
11
Readme
offline-package-vite-plugin
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 offline-package-vite-plugin -D
# yarn
yarn add offline-package-vite-plugin -D
# pnpm
pnpm i offline-package-vite-plugin -D
🦄 Usage
Add OfflinePackageVitePlugin
plugin to vite.config.js / vite.config.ts
and configure it:
- Use (without parameters)
import OfflinePackageVitePlugin from 'offline-package-vite-plugin';
// const { OfflinePackageVitePlugin } = require('offline-package-vite-plugin');
export default {
plugins: [
OfflinePackageVitePlugin()
]
}
- Use (with parameters):Parameters can be customized without restriction
// vite.config.js / vite.config.ts
import OfflinePackageVitePlugin from 'offline-package-vite-plugin';
// const { OfflinePackageVitePlugin } = require('offline-package-vite-plugin');
const { version } = require('./package.json');
export default {
plugins: [
OfflinePackageVitePlugin({version })
]
}
Output
{
"packageId": "main",
"version": 1,
"baseUrl": "https://ww.baidu.com",
"items": [
{
"packageId": "main",
"version": 1,
"path": "css/.pnpm.630e1c71.css",
"remoteUrl": "https://ww.baidu.com/css/.pnpm.630e1c71.css"
},
{
"packageId": "main",
"version": 1,
"path": "css/index.2b637769.css",
"remoteUrl": "https://ww.baidu.com/css/index.2b637769.css"
},
{
"packageId": "main",
"version": 1,
"path": "css/HelloWorld.a10b41ae.css",
"remoteUrl": "https://ww.baidu.com/css/HelloWorld.a10b41ae.css"
},
{
"packageId": "main",
"version": 1,
"path": "css/index.b8624aef.css",
"remoteUrl": "https://ww.baidu.com/css/index.b8624aef.css"
},
{
"packageId": "main",
"version": 1,
"path": "js/HelloWorld.9285d540.js",
"remoteUrl": "https://ww.baidu.com/js/HelloWorld.9285d540.js"
},
{
"packageId": "main",
"version": 1,
"path": "js/index.6406e6e4.js",
"remoteUrl": "https://ww.baidu.com/js/index.6406e6e4.js"
},
{
"packageId": "main",
"version": 1,
"path": "js/index.8a43d7e4.js",
"remoteUrl": "https://ww.baidu.com/js/index.8a43d7e4.js"
},
{
"packageId": "main",
"version": 1,
"path": "js/.pnpm.40fb64bf.js",
"remoteUrl": "https://ww.baidu.com/js/.pnpm.40fb64bf.js"
},
{
"packageId": "main",
"version": 1,
"path": "index.html",
"remoteUrl": "https://ww.baidu.com/index.html"
}
]
}