From ea7132f677ce0ab7c38c107f475a5f93155c4bc9 Mon Sep 17 00:00:00 2001 From: Ely Alvarado Date: Thu, 30 Apr 2020 00:25:34 -0500 Subject: [PATCH] Make content hash consistent across machines (#1085) * Make content hash consistent across machines The metadata used for calculating the content/chunk hash by webpack was including the absolute paths for all the definition files and additional dependencies, which caused the calculated hash to be different depending on the absolute path of the root context. This caused the hash to change between different machines even if there were no changes in the code, which in turn causes issues in certain deployment environments where the build is executed in different server, as is the case in the default Rails deployments in AWS OpsWorks. This commit changes the paths added to the build metadata to be relative to the root context, which makes the content/chunk hash calculation consistent across builds in different machines. * Update Changelog and package.json to v7.0.2 --- CHANGELOG.md | 3 +++ package.json | 2 +- src/index.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d62da038..6180bebaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v7.0.2 +* [Make content hash consistent across machines](https://github.com/TypeStrong/ts-loader/pull/1085) - thanks @elyalvarado + ## v7.0.1 * [fix: watch-run](https://github.com/TypeStrong/ts-loader/pull/1083) - thanks @zn4rk diff --git a/package.json b/package.json index 58c92655c..dbb0d1bcf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "7.0.1", + "version": "7.0.2", "description": "TypeScript loader for webpack", "main": "index.js", "types": "dist", diff --git a/src/index.ts b/src/index.ts index fbe75eaff..6ed21b258 100644 --- a/src/index.ts +++ b/src/index.ts @@ -528,7 +528,7 @@ function getEmit( loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions = dependencies.map( defFilePath => - defFilePath + + path.relative(loaderContext.rootContext,defFilePath) + '@' + ( instance.files.get(defFilePath) ||