mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Setup workbox to generate service worker
This commit is contained in:
parent
f37a83f099
commit
18e045f744
2239
package-lock.json
generated
2239
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -91,6 +91,8 @@
|
||||
"dev": "electron .",
|
||||
"dist": "electron-builder",
|
||||
"beta": "electron-builder --windows portable",
|
||||
"pwa": "node ./scripts/generate_pwa.js",
|
||||
"prepublish": "npm run bundle && npm run pwa",
|
||||
"webapp": "git checkout gh-pages && git merge master && git push && git checkout master"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -99,7 +101,8 @@
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-notarize": "^1.0.0",
|
||||
"webpack": "^5.21.2",
|
||||
"webpack-cli": "^4.5.0"
|
||||
"webpack-cli": "^4.5.0",
|
||||
"workbox-build": "^6.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-updater": "^4.3.1"
|
||||
|
22
scripts/generate_pwa.js
Normal file
22
scripts/generate_pwa.js
Normal file
@ -0,0 +1,22 @@
|
||||
const workbox = require('workbox-build');
|
||||
|
||||
workbox.generateSW({
|
||||
cacheId: 'blockbench',
|
||||
globDirectory: './',
|
||||
globPatterns: [
|
||||
'./index.html',
|
||||
'./favicon.png',
|
||||
'./service_worker.js',
|
||||
|
||||
'./js/**/*',
|
||||
'./lib/**/*',
|
||||
'./css/**/*',
|
||||
'./assets/**/*',
|
||||
'./font/*',
|
||||
'./lang/*',
|
||||
],
|
||||
swDest: './service_worker.js',
|
||||
sourcemap: false
|
||||
}).then(({count, size}) => {
|
||||
console.log(`Generated service-worker, which will precache ${count} files, totaling ${(size/1e6).toFixed(2)} MB.`);
|
||||
});
|
File diff suppressed because one or more lines are too long
1
workbox-1cb178f3.js
Normal file
1
workbox-1cb178f3.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user