mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 13:55:04 +02:00
Update workbox
This commit is contained in:
+14
-2
@@ -299,6 +299,19 @@ const serverDev = cb => {
|
|||||||
cb();
|
cb();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const patchWebWorkerTask = cb => {
|
||||||
|
const t = './dist/browser/sw.min.js';
|
||||||
|
if (fs.existsSync(t)) {
|
||||||
|
fs.renameSync(t, t.replace('.min', ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
const a = './dist/browser/sw.min.js.map';
|
||||||
|
if (fs.existsSync(a)) {
|
||||||
|
fs.unlinkSync(a);
|
||||||
|
}
|
||||||
|
cb();
|
||||||
|
};
|
||||||
|
|
||||||
let webpackScript = 'webpack-prod';
|
let webpackScript = 'webpack-prod';
|
||||||
const webpackArgs = ['--'];
|
const webpackArgs = ['--'];
|
||||||
|
|
||||||
@@ -380,7 +393,6 @@ export {
|
|||||||
build,
|
build,
|
||||||
dev,
|
dev,
|
||||||
sprites,
|
sprites,
|
||||||
|
patchWebWorkerTask as patchWebWorker,
|
||||||
tests as test
|
tests as test
|
||||||
};
|
};
|
||||||
// gulp.watch(['build/**/*.css']).on('change', path => server.notify({ path }));
|
|
||||||
// gulp.watch(['build/**/*.js']).on('change', path => server.notify({ path }));
|
|
||||||
Generated
+1549
-2212
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -10,9 +10,8 @@
|
|||||||
"lint": "tslint -c tslint.json src/ts/**/*.ts",
|
"lint": "tslint -c tslint.json src/ts/**/*.ts",
|
||||||
"dev": "gulp dev",
|
"dev": "gulp dev",
|
||||||
"dev-sprites": "gulp dev --sprites",
|
"dev-sprites": "gulp dev --sprites",
|
||||||
"sw-generate": "workbox generateSW workbox-config.js",
|
"sw-generate": "workbox generateSW workbox-config.js && gulp patchWebWorker",
|
||||||
"sw-uglify": "uglifyjs build/sw.js -o build/sw.min.js",
|
"sw": "npm run sw-generate",
|
||||||
"sw": "npm run sw-generate && npm run sw-uglify",
|
|
||||||
"ts": "tsc",
|
"ts": "tsc",
|
||||||
"ts-tools": "tsc -p tsconfig.tools.json",
|
"ts-tools": "tsc -p tsconfig.tools.json",
|
||||||
"ts-watch": "npm run ts -- --watch",
|
"ts-watch": "npm run ts -- --watch",
|
||||||
@@ -208,7 +207,7 @@
|
|||||||
"webpack-bundle-analyzer": "^5.2.0",
|
"webpack-bundle-analyzer": "^5.2.0",
|
||||||
"webpack-dev-server": "^5.2.3",
|
"webpack-dev-server": "^5.2.3",
|
||||||
"webpack-merge": "^6.0.1",
|
"webpack-merge": "^6.0.1",
|
||||||
"workbox-cli": "^4.3.1",
|
"workbox-cli": "^7.4.0",
|
||||||
"wrapper-webpack-plugin": "^2.2.2",
|
"wrapper-webpack-plugin": "^2.2.2",
|
||||||
"yargs": "^18.0.0",
|
"yargs": "^18.0.0",
|
||||||
"zone.js": "^0.14.2"
|
"zone.js": "^0.14.2"
|
||||||
|
|||||||
+5
-3
@@ -1,5 +1,6 @@
|
|||||||
const { hash } = require('./src/ts/generated/hash.json');
|
const { hash } = require('./src/ts/generated/hash.json');
|
||||||
const ignore = /^\/((a(pi(\d?|-tools)|uth|dm(in)?)|(bl|m)ep)|tools|reload)\/|\.html|^\/sw\.js$/;
|
const ignore = /^\/((a(pi(\d?|-tools)|uth|dm(in)?)|(bl|m)ep)|tools|reload)\/?|\.html|^\/sw\.js$/;
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
globDirectory: 'build/',
|
globDirectory: 'build/',
|
||||||
@@ -7,17 +8,18 @@ module.exports = {
|
|||||||
'**/*.{js,css,png,jpg,wasm}',
|
'**/*.{js,css,png,jpg,wasm}',
|
||||||
],
|
],
|
||||||
globIgnores: [
|
globIgnores: [
|
||||||
|
'**/assets/maps/**',
|
||||||
'**/assets-admin/**',
|
'**/assets-admin/**',
|
||||||
'**/bootstrap-es*',
|
'**/bootstrap-es*',
|
||||||
'**/bootstrap-tools*',
|
'**/bootstrap-tools*',
|
||||||
'**/style-tools*',
|
'**/style-tools*',
|
||||||
'**/style-inline*',
|
'**/style-inline*',
|
||||||
'**/sw.min.js',
|
'**/sw.js',
|
||||||
],
|
],
|
||||||
dontCacheBustURLsMatching: /-[a-f0-9]{10}\./,
|
dontCacheBustURLsMatching: /-[a-f0-9]{10}\./,
|
||||||
swDest: 'build/sw.js',
|
swDest: 'build/sw.js',
|
||||||
navigateFallback: '/',
|
navigateFallback: '/',
|
||||||
navigateFallbackBlacklist: [ignore],
|
navigateFallbackDenylist: [ignore],
|
||||||
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
|
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, // 10 MB
|
||||||
// importWorkboxFrom: 'local',
|
// importWorkboxFrom: 'local',
|
||||||
skipWaiting: true,
|
skipWaiting: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user