log swSource as build fails in CI

This commit is contained in:
Bruno Windels 2021-12-09 15:13:19 +01:00
parent 23e0d3f2ff
commit 9a82f88e1f

View File

@ -100,14 +100,14 @@ function replaceCacheFilenamesInServiceWorker(swChunk, unhashedFilenames, assets
const replaceArrayInSource = (name, value) => {
const newSource = swSource.replace(`${name} = []`, `${name} = ${JSON.stringify(value)}`);
if (newSource === swSource) {
throw new Error(`${name} was not found in the service worker source`);
throw new Error(`${name} was not found in the service worker source: ` + swSource);
}
return newSource;
};
const replaceStringInSource = (name, value) => {
const newSource = swSource.replace(new RegExp(`${name}\\s=\\s"[^"]*"`), `${name} = ${JSON.stringify(value)}`);
if (newSource === swSource) {
throw new Error(`${name} was not found in the service worker source`);
throw new Error(`${name} was not found in the service worker source: ` + swSource);
}
return newSource;
};