Repository URL to install this package:
|
Version:
3.8.1 ▾
|
import { Configuration, Options } from '../../typings'
const PROD_PERF_CONFIG = {
hints: 'warning',
}
export default function performanceMiddleware(
config: Configuration,
options: Options
) {
const { isClient } = options
// Performance budget feature.
// This enables checking of the output bundle size, which will result in
// warnings/errors if the bundle sizes are too large.
// We only want this enabled for our production client. Please
// see the webpack docs on how you can configure this to your own needs:
// https://webpack.js.org/configuration/performance/
// Enable webpack's performance hints for production client builds.
// Else we have to set a value of "false" if we don't want the feature.
const performance = isClient ? PROD_PERF_CONFIG : false
config.performance = performance
}