[Bug Fix] option manager: val = val.buildPreset should be before the check if the preset supports options
This commit is contained in:
committed by
GitHub
parent
3b5a94ed0f
commit
425d460ebf
@@ -268,16 +268,15 @@ export default class OptionManager {
|
||||
val = require(presetLoc);
|
||||
}
|
||||
|
||||
if (typeof val !== "function" && options !== undefined) {
|
||||
throw new Error(`Options ${JSON.stringify(options)} passed to ` +
|
||||
(presetLoc || "a preset") + " which does not accept options.");
|
||||
}
|
||||
|
||||
// For compatibility with babel-core < 6.13.x, allow presets to export an object with a
|
||||
// a 'buildPreset' function that will return the preset itself, while still exporting a
|
||||
// simple object (rather than a function), for supporting old Babel versions.
|
||||
if (typeof val === "object" && val.buildPreset) val = val.buildPreset;
|
||||
|
||||
if (typeof val !== "function" && options !== undefined) {
|
||||
throw new Error(`Options ${JSON.stringify(options)} passed to ` +
|
||||
(presetLoc || "a preset") + " which does not accept options.");
|
||||
}
|
||||
if (typeof val === "function") val = val(context, options);
|
||||
|
||||
if (typeof val !== "object") {
|
||||
|
||||
Reference in New Issue
Block a user