Set extraFeatures.jscript on the server too for better caching.

The jscript transform is perfectly safe for server code, and relatively
cheap compared to the cost of having to compile every file for both the
client and the server, just because the set of plugins is different.
This commit is contained in:
Ben Newman
2016-10-14 14:29:32 -04:00
parent f42ca04fdb
commit 53304c487b
2 changed files with 3 additions and 6 deletions

View File

@@ -311,8 +311,8 @@
"from": "babel-types@>=6.16.0 <6.17.0"
},
"babylon": {
"version": "6.11.4",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.11.4.tgz",
"version": "6.11.6",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.11.6.tgz",
"from": "babylon@>=6.11.4 <6.12.0"
},
"balanced-match": {

View File

@@ -64,16 +64,13 @@ BCp.processOneFileForTarget = function (inputFile, source) {
// compilation, give it the following file extension: .es5.js
! excludedFileExtensionPattern.test(inputFilePath)) {
var targetCouldBeInternetExplorer8 =
inputFile.getArch() === "web.browser";
var extraFeatures = Object.assign({}, this.extraFeatures);
if (! extraFeatures.hasOwnProperty("jscript")) {
// Perform some additional transformations to improve compatibility
// in older browsers (e.g. wrapping named function expressions, per
// http://kiro.me/blog/nfe_dilemma.html).
extraFeatures.jscript = targetCouldBeInternetExplorer8;
extraFeatures.jscript = true;
}
var babelOptions = Babel.getDefaultOptions(extraFeatures);