mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
refactor: move babel defaults value to Options.defaults
This commit is contained in:
parent
97a6f46507
commit
f9d2bce5af
@ -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 })
|
||||
|
@ -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: [],
|
||||
|
Loading…
Reference in New Issue
Block a user