diff --git a/lib/builder/builder.js b/lib/builder/builder.js index 2a519ad722..e54df0bfcc 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -177,14 +177,7 @@ module.exports = class Builder { } getBabelOptions({ isServer }) { - const options = _.defaults( - {}, - this.options.build.babel, - { - babelrc: false, - cacheDirectory: !!this.options.dev - } - ) + const options = _.clone(this.options.build.babel) if (typeof options.presets === 'function') { options.presets = options.presets({ isServer }) diff --git a/lib/common/options.js b/lib/common/options.js index 865553713e..30bb7bd7e1 100644 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -119,6 +119,11 @@ Options.from = function (_options) { options.build.cssSourceMap = options.dev } + // babel cacheDirectory + if (options.build.babel.cacheDirectory === undefined) { + options.build.babel.cacheDirectory = options.dev + } + // Debug errors if (options.debug === undefined) { options.debug = options.dev @@ -210,7 +215,9 @@ Options.defaults = { styleResources: {}, vendor: [], plugins: [], - babel: {}, + babel: { + babelrc: false + }, postcss: {}, templates: [], watch: [],