mirror of
https://github.com/generativefm/generative.fm.git
synced 2026-01-10 23:27:57 -05:00
Remove samples from webpack-offline-plugin cache
This commit is contained in:
@@ -1,24 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const OfflinePlugin = require('offline-plugin');
|
||||
const getSamplesByFormat = require('@generative-music/samples-alex-bainter');
|
||||
const configPromise = require('./webpack.config');
|
||||
|
||||
const samplesByFormat = getSamplesByFormat('//samples.alexbainter.com');
|
||||
|
||||
const allSampleFilenames = ['ogg', 'mp3'].reduce((filenames, format) => {
|
||||
const formatSamples = samplesByFormat[format];
|
||||
return filenames.concat(
|
||||
Object.keys(formatSamples).reduce((sampleFilenames, sampleName) => {
|
||||
const samples = formatSamples[sampleName];
|
||||
if (Array.isArray(samples)) {
|
||||
return sampleFilenames.concat(samples);
|
||||
}
|
||||
return sampleFilenames.concat(Object.values(samples));
|
||||
}, [])
|
||||
);
|
||||
}, []);
|
||||
|
||||
const getConfig = configPromise.then(config => {
|
||||
config.mode = 'production';
|
||||
delete config.devtool;
|
||||
@@ -29,15 +13,11 @@ const getConfig = configPromise.then(config => {
|
||||
'favicon.ico',
|
||||
'manifest.json',
|
||||
'https://platform.twitter.com/widgets.js',
|
||||
].concat(allSampleFilenames),
|
||||
],
|
||||
autoUpdate: true,
|
||||
ServiceWorker: {
|
||||
events: true,
|
||||
},
|
||||
caches: {
|
||||
main: [':rest:'],
|
||||
optional: allSampleFilenames,
|
||||
},
|
||||
})
|
||||
);
|
||||
return config;
|
||||
|
||||
Reference in New Issue
Block a user