rsnext/packages/next/build/webpack/config/utils.ts
Shu Ding 95bd68d25a
Skip loading unused plugins in next dev (#37430)
* dynamically load plugins; switch to type imports; fix page extensions

* fix default export
2022-06-03 14:47:16 -04:00

36 lines
852 B
TypeScript

import type { webpack } from 'next/dist/compiled/webpack/webpack'
import type { NextConfigComplete } from '../../../server/config-shared'
export type ConfigurationContext = {
supportedBrowsers: string[] | undefined
rootDirectory: string
customAppFile: RegExp
isDevelopment: boolean
isProduction: boolean
isServer: boolean
isClient: boolean
isEdgeRuntime: boolean
targetWeb: boolean
assetPrefix: string
sassOptions: any
productionBrowserSourceMaps: boolean
future: NextConfigComplete['future']
experimental: NextConfigComplete['experimental']
}
export type ConfigurationFn = (
a: webpack.Configuration
) => webpack.Configuration
export const pipe =
<R>(...fns: Array<(a: R) => R | Promise<R>>) =>
(param: R) =>
fns.reduce(
async (result: R | Promise<R>, next) => next(await result),
param
)