diff --git a/packages/gatsby/src/cache-dir/static-entry.js b/packages/gatsby/src/cache-dir/static-entry.js index 090ba7f0ef582..bcc1d617423db 100644 --- a/packages/gatsby/src/cache-dir/static-entry.js +++ b/packages/gatsby/src/cache-dir/static-entry.js @@ -116,11 +116,12 @@ module.exports = (locals, callback) => { ] dascripts.forEach(script => { const fetchKey = `assetsByChunkName[${script}]` - let prefixedScript = `${linkPrefix}${get(stats, fetchKey, ``)}` + let fetchedScript = get(stats, fetchKey) // If sourcemaps are enabled, then the entry will be an array with // the script name as the first entry. - prefixedScript = isArray(prefixedScript) ? prefixedScript[0] : prefixedScript + fetchedScript = isArray(fetchedScript) ? fetchedScript[0] : fetchedScript + const prefixedScript = `${linkPrefix}${fetchedScript}` // Make sure we found a component. if (prefixedScript === `/`) {