Allow overwritting of sourceRoot (#3685)

Also replaces lodash/extend with Object.assign
This commit is contained in:
Daniel Tschinder 2016-09-03 18:12:34 +02:00 committed by Henry Zhu
parent 460714b126
commit 71dff8c834

View File

@ -48,10 +48,11 @@ function compile(filename) {
let result;
// merge in base options and resolve all the plugins and presets relative to this file
let opts = new OptionManager().init(extend(deepClone(transformOpts), {
filename,
sourceRoot: path.dirname(filename)
}));
let opts = new OptionManager().init(extend(
{ sourceRoot: path.dirname(filename) }, // sourceRoot can be overwritten
deepClone(transformOpts),
{ filename }
));
let cacheKey = `${JSON.stringify(opts)}:${babel.version}`;