fix(ts): add type definition for functional babel.presets (#5785)

This commit is contained in:
Xin Du (Clark) 2019-05-22 20:57:17 +01:00 committed by Pooya Parsa
parent ec391b9f0e
commit 59071e4c6d

View File

@ -8,7 +8,7 @@ import {
Options as WebpackOptions,
Plugin as WebpackPlugin
} from 'webpack'
import { TransformOptions } from '@babel/core'
import { TransformOptions, PluginItem } from '@babel/core'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
import { Options as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware'
@ -18,9 +18,17 @@ import { TerserPluginOptions } from 'terser-webpack-plugin'
type NuxtConfigurationLoaders = any // TBD
interface NuxtBabelPresetEnv {
isServer: boolean
}
interface NuxtBabelOptions extends Pick<TransformOptions, Exclude<keyof TransformOptions, 'presets'>> {
presets?: ((env: NuxtBabelPresetEnv, defaultPreset: [string, object]) => PluginItem[] | void) | PluginItem[] | null
}
export interface NuxtConfigurationBuild {
analyze?: BundleAnalyzerPlugin.Options | boolean
babel?: TransformOptions
babel?: NuxtBabelOptions
cache?: boolean
crossorigin?: string
cssSourceMap?: boolean