Skip to content

Commit

Permalink
chore(webpack): remove workbox-webpack-plugin, we roll our own servic…
Browse files Browse the repository at this point in the history
…e worker
  • Loading branch information
LeoMcA committed May 9, 2024
1 parent cf77437 commit 2245351
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 515 deletions.
1 change: 0 additions & 1 deletion client/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const config = {
yarnLockFile: resolveApp("../yarn.lock"),
testsSetup: resolveModule(resolveApp, "src/setupTests"),
proxySetup: resolveApp("src/setupProxy.js"),
swSrc: resolveModule(resolveApp, "src/service-worker"),
publicUrlOrPath,
libsPath: resolveApp("../libs"),
moduleFileExtensions,
Expand Down
18 changes: 0 additions & 18 deletions client/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

Expand All @@ -11,7 +10,6 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin";
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
import { WebpackManifestPlugin } from "webpack-manifest-plugin";
import InterpolateHtmlPlugin from "react-dev-utils/InterpolateHtmlPlugin.js";
import WorkboxWebpackPlugin from "workbox-webpack-plugin";
import ModuleScopePlugin from "react-dev-utils/ModuleScopePlugin.js";
import ESLintPlugin from "eslint-webpack-plugin";
import ModuleNotFoundPlugin from "react-dev-utils/ModuleNotFoundPlugin.js";
Expand Down Expand Up @@ -46,9 +44,6 @@ const babelRuntimeRegenerator = resolve.sync("@babel/runtime/regenerator", {
const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === "true";
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === "true";

// Get the path to the uncompiled service worker (if it exists).
const swSrc = paths.swSrc;

const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
return false;
Expand Down Expand Up @@ -538,19 +533,6 @@ function config(webpackEnv) {
};
},
}),
// Generate a service worker script that will precache, and keep up to date,
// the HTML & assets that are part of the webpack build.
isEnvProduction &&
fs.existsSync(swSrc) &&
new WorkboxWebpackPlugin.InjectManifest({
swSrc,
dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./,
exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/],
// Bump up the default maximum size (2mb) that's precached,
// to make lazy-loading failure scenarios less likely.
// See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
}),
// TypeScript type checking
new ForkTsCheckerWebpackPlugin({
async: isEnvDevelopment,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
"webpack-manifest-plugin": "^5.0.0",
"webpack-node-externals": "^3.0.0",
"workbox-webpack-plugin": "^7.1.0"
"webpack-node-externals": "^3.0.0"
},
"engines": {
"node": ">=18.16.0"
Expand Down
Loading

0 comments on commit 2245351

Please sign in to comment.