@vercel/microfrontends
Version:
Defines configuration and utilities for microfrontends development
43 lines (38 loc) • 1.45 kB
TypeScript
import { NextConfig } from 'next';
type TransformKeys = 'assetPrefix' | 'buildId' | 'draftMode' | 'redirects' | 'rewrites' | 'transpilePackages' | 'webpack';
interface WithMicrofrontendsOptions {
/**
* Explicitly set the name of the application instead of using the name from the package.json.
*/
appName?: string;
isProduction?: () => boolean;
debug?: boolean;
skipTransforms?: TransformKeys[];
/**
* True to enable support for Next.js pages router. This is disabled by
* default since it modifies Webpack chunking behavior, so it should only be
* enabled when necessary.
*/
supportPagesRouter?: boolean;
configPath?: string;
}
/**
* Automatically configures your Next.js application to work with microfrontends.
*
* This function should wrap your Next.js config object before it is exported. It
* will automatically set up the necessary fields and environment variables for
* microfrontends to work.
*
* See the [Getting Started](https://vercel.com/docs/microfrontends/quickstart) guide for more information.
*
* @example Wrapping your Next.js config
* ```js
* import { withMicrofrontends } from '@vercel/microfrontends/next/config';
*
* const nextConfig = { ... };
*
* export default withMicrofrontends(nextConfig);
* ```
*/
declare function withMicrofrontends(nextConfig: NextConfig, opts?: WithMicrofrontendsOptions): NextConfig;
export { withMicrofrontends };