Skip to content

Commit

Permalink
fix(ts): add type definition for functional babel.presets (#5785)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo authored and pi0 committed May 22, 2019
1 parent ec391b9 commit 59071e4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/config/types/build.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down

0 comments on commit 59071e4

Please sign in to comment.