Skip to content

Commit

Permalink
change caching
Browse files Browse the repository at this point in the history
  • Loading branch information
zefanjajobse committed Aug 4, 2023
1 parent a469de4 commit 14066e4
Show file tree
Hide file tree
Showing 4 changed files with 540 additions and 422 deletions.
33 changes: 33 additions & 0 deletions configs/webpack/prod.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// production config
const { merge } = require("webpack-merge");
const { resolve } = require("path");
const { GenerateSW } = require("workbox-webpack-plugin");

const commonConfig = require("./common");

Expand All @@ -16,4 +17,36 @@ module.exports = merge(commonConfig, {
react: "React",
"react-dom": "ReactDOM",
},
plugins: [
new GenerateSW({
runtimeCaching: [
{
urlPattern: /assets/,
handler: "CacheFirst",
},
{
urlPattern: new RegExp(
"^https://fonts.(?:googleapis|gstatic).com/(.*)",
),
handler: "CacheFirst",
},
{
urlPattern: new RegExp(
"^https://cdn.jsdelivr.net/(.*)"
),
handler: "CacheFirst"
},
{
urlPattern: new RegExp(
"^https://unpkg.com/(.*)"
),
handler: "CacheFirst"
},
{
urlPattern: /.*/,
handler: "NetworkFirst",
},
],
}),
],
});
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,32 @@
"start-prod": "pnpm build && node express.js"
},
"devDependencies": {
"@swc/core": "^1.3.71",
"@swc/core": "^1.3.74",
"@testing-library/react": "^14.0.0",
"@types/file-saver": "^2.0.5",
"@types/jest": "^29.5.3",
"@types/node": "^20.4.5",
"@types/react": "^18.2.16",
"@types/node": "^20.4.7",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^6.2.1",
"@typescript-eslint/parser": "^6.2.1",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.8.1",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.46.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react": "^7.33.1",
"express": "^4.18.2",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.3",
"jest": "^29.6.1",
"prettier": "^3.0.0",
"jest": "^29.6.2",
"prettier": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.1",
"sass": "^1.64.1",
"sass": "^1.64.2",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
"swc-loader": "^0.2.3",
Expand All @@ -68,16 +68,16 @@
"workbox-webpack-plugin": "^7.0.0"
},
"dependencies": {
"@tanstack/react-query": "^4.32.0",
"chart.js": "^4.3.1",
"@tanstack/react-query": "^4.32.5",
"chart.js": "^4.3.3",
"chartjs-adapter-date-fns": "^3.0.0",
"chartjs-plugin-zoom": "^2.0.1",
"date-fns": "^2.30.0",
"file-saver": "^2.0.5",
"i18next": "^23.2.11",
"i18next": "^23.4.1",
"i18next-browser-languagedetector": "^7.1.0",
"react-chartjs-2": "^5.2.0",
"react-i18next": "^13.0.2",
"react-i18next": "^13.0.3",
"react-router-dom": "^6.14.2",
"react-use": "^17.4.0",
"regenerator-runtime": "^0.13.11",
Expand Down
Loading

0 comments on commit 14066e4

Please sign in to comment.