[babel] configure a specific cache path

Babel needs a path to write its cache, which it automatically places to $HOME or tmp if
$HOME is not defined. This causes problems when the $HOME directory is not writable or
we just do not want to write to such a central location. So This moves the cache to the
project directory by setting the BABEL_CACHE_PATH environment variable.
This commit is contained in:
spalger 2015-10-30 10:56:50 -05:00
parent 61554e0f46
commit 2e4140e94b
4 changed files with 9 additions and 2 deletions

1
.gitignore vendored
View file

@ -19,3 +19,4 @@ webpackstats.json
config/kibana.dev.yml
coverage
selenium
.babelcache.json

View file

@ -1,2 +1,5 @@
require('babel/register')(require('../optimize/babelOptions').node);
// load the babel options seperately so that they can modify the process.env
// before calling babel/register
const babelOptions = require('../optimize/babelOptions').node;
require('babel/register')(babelOptions);
require('./cli');

View file

@ -1,4 +1,5 @@
var fromRoot = require('requirefrom')('src/utils')('fromRoot');
var fromRoot = require('path').resolve.bind(null, __dirname, '../../');
process.env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json');
exports.webpack = {
stage: 1,

View file

@ -1,3 +1,5 @@
process.env.BABEL_CACHE_PATH = require('path').resolve(__dirname, '../../optimize/.babelcache.json');
exports.webpack = {
stage: 1,
nonStandard: false,