Skip to content

Commit

Permalink
Make content hash consistent across machines (#1085)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
elyalvarado committed Apr 30, 2020
1 parent cc31287 commit bbc6d81
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions 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

Expand Down
2 changes: 1 addition & 1 deletion 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",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -528,7 +528,7 @@ function getEmit(

loaderContext._module.buildMeta.tsLoaderDefinitionFileVersions = dependencies.map(
defFilePath =>
defFilePath +
path.relative(loaderContext.rootContext,defFilePath) +
'@' +
(
instance.files.get(defFilePath) ||
Expand Down

0 comments on commit bbc6d81

Please sign in to comment.