UNPKG

@frontity/core

Version:

The core package of the Frontity framework.

39 lines (35 loc) 957 B
import { Target, WebpackConfig } from "@frontity/types/config"; /** * The options of the {@link performance} function. */ interface PerformanceOptions { /** * The target of the build: "server", "es5" or "module". */ target: Target; } /** * Generate the object for Webpack's performance configuration. * * Official Webpack docs: https://webpack.js.org/configuration/performance/. * * @param options - Defined in {@link PerformanceOptions}. * * @returns The configuration object for Webpack. */ const performance = ({ target, }: PerformanceOptions): WebpackConfig["performance"] => ({ ...(target === "server" ? { // Max size recommended for the server bundle: 5Mbs. maxEntrypointSize: 5000000, maxAssetSize: 5000000, } : { // Max size recommended for the client bundles: 500Kbs. maxEntrypointSize: 500000, maxAssetSize: 500000, }), }); export default performance;