fixed favicons and added service-worker

Signed-off-by: Pascal Syma <pascal@syma.dev>
This commit is contained in:
2020-07-11 16:23:53 +02:00
parent 07e08ba4f6
commit 600575655d
5 changed files with 2082 additions and 6 deletions
+2059
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -38,7 +38,8 @@
"webpack": "^4.41.2", "webpack": "^4.41.2",
"webpack-cli": "^3.3.10", "webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0", "webpack-dev-server": "^3.9.0",
"webpack-merge": "^4.2.2" "webpack-merge": "^4.2.2",
"workbox-webpack-plugin": "^5.1.3"
}, },
"dependencies": { "dependencies": {
"phaser": "^3.20.1", "phaser": "^3.20.1",
+6
View File
@@ -37,4 +37,10 @@ const config = {
} }
}; };
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('./service-worker.js').then();
});
}
const game = new Phaser.Game(config); const game = new Phaser.Game(config);
+6 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020. Pascal Syma <pascal@syma.dev> * Copyright (c) 2020. Antonio Martinez Casadesus and Pascal Syma.
* All rights reserved. * All rights reserved.
*/ */
@@ -46,8 +46,11 @@ module.exports = {
logo: './public/favicon.png', logo: './public/favicon.png',
publicPath: "./", publicPath: "./",
favicons: { favicons: {
appName: 'mi2mario', manifestRelativePaths: true,
appDescription: 'MI2Mario', start_url: "../",
appName: 'MI2Mario',
appDescription: 'MI2 Mario',
appShortName: "mi2mario",
developerName: 'Pascal Syma', developerName: 'Pascal Syma',
developerURL: "https://syma.dev", developerURL: "https://syma.dev",
background: '#000', background: '#000',
+9 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020. Pascal Syma <pascal@syma.dev> * Copyright (c) 2020. Antonio Martinez Casadesus and Pascal Syma.
* All rights reserved. * All rights reserved.
*/ */
@@ -7,6 +7,7 @@ const merge = require("webpack-merge");
const path = require("path"); const path = require("path");
const base = require("./base"); const base = require("./base");
const TerserPlugin = require("terser-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin");
const WorkboxPlugin = require('workbox-webpack-plugin');
module.exports = merge(base, { module.exports = merge(base, {
mode: "production", mode: "production",
@@ -28,5 +29,11 @@ module.exports = merge(base, {
} }
}) })
] ]
} },
plugins: [
new WorkboxPlugin.GenerateSW({
clientsClaim: true,
skipWaiting: true,
}),
]
}); });