Use published sw.js from wabac.js instead of rebuilding a custom version. (#223)

* sw: instead of rebuilding sw.js with slightly different settings (baked in index.html + ruffle.js cache),
can now just use the published sw.js release with custom queryArgs, injectScripts=ruffle/ruffle.js
index.html is cached automatically on-load
webpack: for dev server, still build 'sw.js' locally to allow dynamic updates when developing on a linked wabac.js
remove src/sw.js, as no longer used, just importing from wabac.js directly
bump to 1.8.9
This commit is contained in:
Ilya Kreymer
2023-08-28 19:59:29 -07:00
committed by GitHub
parent 0cc1824b3a
commit 2bc9fb0a15
7 changed files with 59 additions and 70 deletions
+21 -10
View File
@@ -77,15 +77,30 @@ const electronPreloadConfig = (/*env, argv*/) => {
const browserConfig = (/*env, argv*/) => {
const isDevServer = process.env.WEBPACK_SERVE;
const entry = {
"ui": "./src/ui.js"
};
const patterns = [
{ from: "package.json", to: "_data/package.json" }
];
if (isDevServer) {
entry["sw"] = "@webrecorder/wabac/src/sw.js";
} else {
patterns.push(
{ from: "node_modules/@webrecorder/wabac/dist/sw.js", to: "sw.js"}
);
}
return {
target: "web",
mode: "production",
resolve: {fallback: { "crypto": false }},
entry: {
"ui": "./src/ui.js",
"sw": "./src/sw.js"
},
entry,
optimization,
output: {
@@ -130,11 +145,7 @@ const browserConfig = (/*env, argv*/) => {
__VERSION__: JSON.stringify(package_json.version),
}),
new webpack.BannerPlugin(BANNER_TEXT),
new CopyPlugin({
patterns: [
{ from: "package.json", to: "_data/package.json" }
]
}),
new CopyPlugin({ patterns })
],
module: {