Skip to content


Browse files Browse the repository at this point in the history
packager: Bundler: use transform module hash instead of mtime
Summary: mtime is a problem for the global cache, because everyone has different times at which they rebased/cloned the repo. Use the actual content instead. Of course, the file could depend on other files we don't take into account... but the mtime solution was already problematic in that regard, so I assume this is a safe change.

Reviewed By: davidaurelio

Differential Revision: D4237826

fbshipit-source-id: 9dc18eb422cddd4d5ed097d1ebeef4b8c361ff39
  • Loading branch information
Jean Lauliac authored and Facebook Github Bot committed Nov 29, 2016
1 parent a50bafa commit e485f69
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packager/react-packager/src/Bundler/index.js
Expand Up @@ -12,6 +12,7 @@
'use strict';

const assert = require('assert');
const crypto = require('crypto');
const fs = require('fs');
const Cache = require('../node-haste').Cache;
const Transformer = require('../JSTransformer');
Expand Down Expand Up @@ -146,20 +147,21 @@ class Bundler {


let mtime;
let transformModuleHash;
try {
({mtime} = fs.statSync(opts.transformModulePath));
mtime = String(mtime.getTime());
const transformModuleStr = fs.readFileSync(opts.transformModulePath);
transformModuleHash =
} catch (error) {
mtime = '';
transformModuleHash = '';

const cacheKeyParts = [

this._getModuleId = createModuleIdFactory();
Expand Down

0 comments on commit e485f69

Please sign in to comment.