fix(client): add cache-busting hashes to chunks (#37746)

* fix(client): add cache-busting hashes to chunks

* fix: create cache-busting names for the workers

Prior to this PR the first webpack compilation gave the workers static
names.  This can cause caching problems, so this PR adds hashes to
their names to invalidate the cache.

In order for Gatsby to find them, the names are added to the
config directory.
This commit is contained in:
Oliver Eyton-Williams
2019-11-14 21:13:44 +01:00
committed by mrugesh
parent c4dc0b297f
commit 687c4fdb98
5 changed files with 34 additions and 6 deletions

View File

@@ -18,6 +18,10 @@ import protect from 'loop-protect';
import * as vinyl from '../utils/polyvinyl.js';
import createWorker from '../utils/worker-executor';
// the config files are created during the build, but not before linting
// eslint-disable-next-line import/no-unresolved
import { filename as sassCompile } from '../../../../config/sass-compile';
const protectTimeout = 100;
Babel.registerPlugin('loopProtection', protect(protectTimeout));
@@ -89,7 +93,7 @@ export const babelTransformer = cond([
[stubTrue, identity]
]);
const sassWorker = createWorker('sass-compile');
const sassWorker = createWorker(sassCompile);
async function transformSASS(element) {
const styleTags = element.querySelectorAll('style[type="text/sass"]');
await Promise.all(