Webpack: OfflinePlugin improvements

This commit is contained in:
Alex Gleason 2021-09-10 20:11:36 -05:00
parent 1c39e1b086
commit a720f3ea32
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -25,7 +25,19 @@ module.exports = merge(sharedConfig, {
new OfflinePlugin({
caches: {
main: [':rest:'],
additional: [':externals:'],
additional: [
'packs/emoji/1f602-*.svg', // used for emoji picker dropdown
'packs/images/32-*.png', // used in emoji-mart
// Default emoji reacts
'packs/emoji/1f44d-*.svg', // Thumbs up
'packs/emoji/2764-*.svg', // Heart
'packs/emoji/1f606-*.svg', // Laughing
'packs/emoji/1f62e-*.svg', // Surprised
'packs/emoji/1f622-*.svg', // Crying
'packs/emoji/1f629-*.svg', // Weary
'packs/emoji/1f621-*.svg', // Angry (Spinster)
],
optional: [
'**/locale_*.js', // don't fetch every locale; the user only needs one
'**/*_polyfills-*.js', // the user may not need polyfills
@ -36,22 +48,10 @@ module.exports = merge(sharedConfig, {
'**/*.svg',
],
},
externals: [
'/emoji/1f602.svg', // used for emoji picker dropdown
'/emoji/sheet_13.png', // used in emoji-mart
// Default emoji reacts
'/emoji/1f44d.svg', // Thumbs up
'/emoji/2764.svg', // Heart
'/emoji/1f606.svg', // Laughing
'/emoji/1f62e.svg', // Surprised
'/emoji/1f622.svg', // Crying
'/emoji/1f629.svg', // Weary
'/emoji/1f621.svg', // Angry (Spinster)
],
excludes: [
'**/*.gz',
'**/*.map',
'**/*.LICENSE.txt',
'stats.json',
'report.html',
'instance/**/*',
@ -65,9 +65,10 @@ module.exports = merge(sharedConfig, {
'**/*.ogg',
'**/*.oga',
'**/*.mp3',
'sounds/**/*',
// Don't cache index.html
// Don't serve index.html
// https://github.com/bromite/bromite/issues/1294
'index.html',
'404.html',
],
// ServiceWorker: {
// entry: join(__dirname, '../app/soapbox/service_worker/entry.js'),