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

@ -49,6 +49,8 @@ const {
createPoly
} = require('../../client/src/templates/Challenges/utils/polyvinyl');
const testEvaluator = require('../../client/config/test-evaluator').filename;
const oldRunnerFail = Mocha.Runner.prototype.fail;
Mocha.Runner.prototype.fail = function(test, err) {
if (err instanceof AssertionError) {
@ -327,7 +329,7 @@ async function createTestRunnerForJSChallenge({ files }, solution) {
const { build, sources } = await buildJSChallenge({ files });
const code = sources && 'index' in sources ? sources['index'] : '';
const testWorker = createWorker('test-evaluator', { terminateWorker: true });
const testWorker = createWorker(testEvaluator, { terminateWorker: true });
return async ({ text, testString }) => {
try {
const { pass, err } = await testWorker.execute(