Skip to content

Commit

Permalink
Merge pull request #1463 from ita-social-projects/feature/issue-1807
Browse files Browse the repository at this point in the history
Feature/issue 1807
  • Loading branch information
Michael-Kolpakov authored Nov 1, 2024
2 parents d7888ce + 0c37593 commit f82268c
Showing 1 changed file with 52 additions and 51 deletions.
103 changes: 52 additions & 51 deletions config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,57 +38,58 @@ module.exports = {
new Dotenv({
path: `./.env`,
}),
new GenerateSW({
skipWaiting: true,
clientsClaim: true,
maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
runtimeCaching: [
{
urlPattern: /env-config\.js$/,
handler: 'NetworkOnly'
},
{
urlPattern: /\.(?:js|css)$/,
handler: 'CacheFirst',
options: {
cacheName: 'static-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
handler: 'CacheFirst',
options: {
cacheName: 'image-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
},
},
},
{
urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
handler:'CacheFirst',
options: {
cacheName: 'font-resources',
expiration: {
maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
},
},
},
{
urlPattern: /^https?.*/,
handler: 'NetworkFirst',
options: {
cacheName: 'external-resources',
expiration: {
maxEntries: 260
},
},
},
],
}),
// Caching with Service Worker interferes developing process and leads to unpredictable result
// new GenerateSW({
// skipWaiting: true,
// clientsClaim: true,
// maximumFileSizeToCacheInBytes: 10 * 1024 * 1024,
// runtimeCaching: [
// {
// urlPattern: /env-config\.js$/,
// handler: 'NetworkOnly'
// },
// {
// urlPattern: /\.(?:js|css)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'static-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:png|jpg|jpeg|svg|gif)$/,
// handler: 'CacheFirst',
// options: {
// cacheName: 'image-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 7, // 1 week
// },
// },
// },
// {
// urlPattern: /\.(?:woff|woff2|ttf|otf)$/,
// handler:'CacheFirst',
// options: {
// cacheName: 'font-resources',
// expiration: {
// maxAgeSeconds: 60 * 60 * 24 * 90, // 3 months
// },
// },
// },
// {
// urlPattern: /^https?.*/,
// handler: 'NetworkFirst',
// options: {
// cacheName: 'external-resources',
// expiration: {
// maxEntries: 260
// },
// },
// },
// ],
// }),
],
optimization: {
splitChunks: {
Expand Down

0 comments on commit f82268c

Please sign in to comment.