Skip to content

Commit

Permalink
Fix non-updating asset hashes (#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeMoorJasper authored and devongovett committed Aug 24, 2018
1 parent f304cce commit 8ea912c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/core/parcel-bundler/src/Asset.js
Expand Up @@ -2,13 +2,13 @@ const URL = require('url');
const path = require('path');
const clone = require('clone');
const fs = require('./utils/fs');
const objectHash = require('./utils/objectHash');
const md5 = require('./utils/md5');
const isURL = require('./utils/is-url');
const config = require('./utils/config');
const syncPromise = require('./utils/syncPromise');
const logger = require('./Logger');
const Resolver = require('./Resolver');
const objectHash = require('./utils/objectHash');

/**
* An Asset represents a file in the dependency tree. Assets can have multiple
Expand Down Expand Up @@ -203,7 +203,6 @@ class Asset {
await this.getDependencies();
await this.transform();
this.generated = await this.generate();
this.hash = await this.generateHash();
}

return this.generated;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/parcel-bundler/src/Pipeline.js
@@ -1,6 +1,5 @@
const Parser = require('./Parser');
const path = require('path');
const md5 = require('./utils/md5');

/**
* A Pipeline composes multiple Asset types together.
Expand Down Expand Up @@ -72,20 +71,21 @@ class Pipeline {
}

generated = generated.concat(processed);
asset.hash = md5(asset.hash + subAsset.hash);
} else {
generated.push(rendition);
}
}

// Post process. This allows assets a chance to modify the output produced by sub-asset types.
asset.generated = generated;
try {
generated = await asset.postProcess(generated);
} catch (err) {
throw asset.generateErrorMessage(err);
}

asset.generated = generated;
asset.hash = await asset.generateHash();

return generated;
}

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -7255,4 +7255,4 @@ yargs@~3.10.0:
camelcase "^1.0.2"
cliui "^2.1.0"
decamelize "^1.0.0"
window-size "0.1.0"
window-size "0.1.0"

0 comments on commit 8ea912c

Please sign in to comment.