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

@@ -324,14 +324,16 @@ export default class OptionManager {
}
}
init(opts: Object): Object {
init(opts: Object = {}): Object {
let filename = opts.filename;
// resolve all .babelrc files
if (opts.babelrc !== false) {
this.findConfigs(opts.filename);
this.findConfigs(filename);
}
// merge in base options
this.mergeOptions(opts, "base");
this.mergeOptions(opts, "base", null, filename && path.dirname(filename));
// normalise
this.normaliseOptions(opts);