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, Options as WebpackOptions,
Plugin as WebpackPlugin Plugin as WebpackPlugin
} from 'webpack' } from 'webpack'
import { TransformOptions } from '@babel/core' import { TransformOptions, PluginItem } from '@babel/core'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware' import { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
import { Options as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware' import { Options as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware'
@ -18,9 +18,17 @@ import { TerserPluginOptions } from 'terser-webpack-plugin'
type NuxtConfigurationLoaders = any // TBD 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 { export interface NuxtConfigurationBuild {
analyze?: BundleAnalyzerPlugin.Options | boolean analyze?: BundleAnalyzerPlugin.Options | boolean
babel?: TransformOptions babel?: NuxtBabelOptions
cache?: boolean cache?: boolean
crossorigin?: string crossorigin?: string
cssSourceMap?: boolean cssSourceMap?: boolean