From f47557e2dc2fc44ff630c5471919dfff3cdb49c6 Mon Sep 17 00:00:00 2001 From: Robert Long <robert@robertlong.me> Date: Thu, 7 Dec 2017 18:46:33 -0800 Subject: [PATCH] Disable file hash cache busting query strings to fix production builds. --- templates/helpers.js | 45 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/templates/helpers.js b/templates/helpers.js index 5f66a4cf3..44b58374b 100644 --- a/templates/helpers.js +++ b/templates/helpers.js @@ -17,30 +17,31 @@ module.exports = { return new Handlebars.SafeString(assetPath); } - const compilation = options.data.root.compilation; - - let asset; - if (compilation.assets[assetPath]) { - asset = compilation.assets[assetPath].source(); - } else { - const outputPath = options.data.root.compiler.options.output.path; - const localPath = path.join(outputPath, assetPath); - - try { - asset = fs.readFileSync(localPath); - } catch (err) { - compilation.errors.push( - err.message + - " Availible assets: " + - Object.keys(compilation.assets).jojn(", ") - ); - } - } - - const hash = crc.crc32(asset).toString(16); + // const compilation = options.data.root.compilation; + + // let asset; + // if (compilation.assets[assetPath]) { + // asset = compilation.assets[assetPath].source(); + // } else { + // const outputPath = options.data.root.compiler.options.output.path; + // const localPath = path.join(outputPath, assetPath); + + // try { + // asset = fs.readFileSync(localPath); + // } catch (err) { + // compilation.errors.push( + // err.message + + // " Availible assets: " + + // Object.keys(compilation.assets).jojn(", ") + // ); + // } + // } + + // const hash = crc.crc32(asset).toString(16); + // const cacheBustQueryString = "?crc=" + hash; + const cacheBustQueryString = "?d=" + Date.now(); const baseAssetsPath = options.data.root.baseAssetsPath || ""; - const cacheBustQueryString = "?crc=" + hash; const url = baseAssetsPath + assetPath + cacheBustQueryString; -- GitLab