Ensure file.hash is always computed from sha1(file.data). #10330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the introduction of lazy compilation in Meteor 1.8, calling
becomes problematic, since
inputFile.getSourceHash()is usually different fromcompiler.processFilesForTarget(inputFile).hash, because the latter is computed from the compiled code, whereas the former is computed from the source code.For example, when we use
file.hashto cache imported module identifiers inImportScanner#_findImportedModuleIdentifiers, we really need to be using the hash of the compiled code, since a single source module can be compiled in different ways. If we cache based on the source hash, there's a risk of reusing the scanned imports from theweb.browserversion for theweb.browser.legacyversion, which can lead to all sorts of problems that are only apparent in legacy browsers.The quick fix is easy enough:
BabelCompilercan simply stop including ahashin the eager options toinputFile.addJavaScript. This fix can be published as a minor update to thebabel-compilerandecmascriptpackages.The remaining changes in this commit add another layer of defense against this problem, by ignoring any hash options provided by compiler plugins, in favor of simply computing the hash from the compiled data buffer. These additional changes will become available in the next release of Meteor (likely 1.8.0.1).