make base option plugin/preset resolving happen relative to the input filename
This commit is contained in:
parent
89d9db8648
commit
8fd543edae
@ -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);
|
||||
|
||||
@ -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}`;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user