A Webpack Plugin, function is apply localStorage cache javascript
MIT License
Apply localStorage cache JavaScript file
Before After
4.0
$ npm install webpack-cache-scripts-to-local --save-dev
const WebpackCacheScriptsToLocal = require('webpack-cache-scripts-to-local')
module.exports = {
plugins: [
new WebpackCacheScriptsToLocal({
name: 'test',
separator: '-',
driverName: ['indexedDB', 'webSQL', 'localStorage'],
chunks: ['main']
})
]
}
This default value is store
The name of your repository, if stored in a local Storage, will be applied to the prefix of key; if stored in IndexedDB or WebSQL, it will be the name of the repository.
This value is necessary, default value is -
Specify the separation between the file name of your packaged JavaScript file and Hash.
Choose a driver for your local storage, either one or more.
This default value is [indexedDB, webSQL, localStorage]
If the value is a string, then the driver of this value is applied.
new WebpackCacheScriptsToLocal({
name: 'test',
separator: '-',
driverName: 'localStorage'
})
If the value is an array, all the drivers in the array are applied in the order of priority.
new WebpackCacheScriptsToLocal({
name: 'test',
separator: '-',
driverName: ['indexedDB', 'webSQL', 'localStorage']
})
You need cached chunk packages,local caching can be done according to the chunks you pack.
This is default value all chunks