make base option plugin/preset resolving happen relative to the input filename

This commit is contained in:
Sebastian McKenzie
2015-11-18 20:31:59 -08:00
parent 89d9db8648
commit 8fd543edae
2 changed files with 11 additions and 8 deletions

View File

@@ -46,14 +46,15 @@ function mtime(filename) {
return +fs.statSync(filename).mtime;
}
function compile(filename, opts = {}) {
function compile(filename) {
let result;
opts.filename = filename;
let optsManager = new OptionManager;
optsManager.mergeOptions(deepClone(transformOpts));
opts = optsManager.init(opts);
// merge in base options and resolve all the plugins and presets relative to this file
optsManager.mergeOptions(deepClone(transformOpts), "base", null, path.dirname(filename));
let opts = optsManager.init({ filename });
let cacheKey = `${JSON.stringify(opts)}:${babel.version}`;