@sentry/nextjs
Version:
Official Sentry SDK for Next.js
38 lines • 2.44 kB
TypeScript
import type { BuildContext, NextConfigObject, SentryWebpackPluginOptions, UserSentryOptions, WebpackConfigFunction } from './types';
/**
* Construct the function which will be used as the nextjs config's `webpack` value.
*
* Sets:
* - `devtool`, to ensure high-quality sourcemaps are generated
* - `entry`, to include user's sentry config files (where `Sentry.init` is called) in the build
* - `plugins`, to add SentryWebpackPlugin
*
* @param userNextConfig The user's existing nextjs config, as passed to `withSentryConfig`
* @param userSentryWebpackPluginOptions The user's SentryWebpackPlugin config, as passed to `withSentryConfig`
* @returns The function to set as the nextjs config's `webpack` value
*/
export declare function constructWebpackConfigFunction(userNextConfig?: NextConfigObject, userSentryWebpackPluginOptions?: Partial<SentryWebpackPluginOptions>, userSentryOptions?: UserSentryOptions): WebpackConfigFunction;
/**
* Search the project directory for a valid user config file for the given platform, allowing for it to be either a
* TypeScript or JavaScript file.
*
* @param projectDir The root directory of the project, where the file should be located
* @param platform Either "server", "client" or "edge", so that we know which file to look for
* @returns The name of the relevant file. If the server or client file is not found, this method throws an error. The
* edge file is optional, if it is not found this function will return `undefined`.
*/
export declare function getUserConfigFile(projectDir: string, platform: 'server' | 'client' | 'edge'): string | undefined;
/**
* Gets the absolute path to a sentry config file for a particular platform. Returns `undefined` if it doesn't exist.
*/
export declare function getUserConfigFilePath(projectDir: string, platform: 'server' | 'client' | 'edge'): string | undefined;
/**
* Combine default and user-provided SentryWebpackPlugin options, accounting for whether we're building server files or
* client files.
*
* @param buildContext Nexjs-provided data about the current build
* @param userPluginOptions User-provided SentryWebpackPlugin options
* @returns Final set of combined options
*/
export declare function getWebpackPluginOptions(buildContext: BuildContext, userPluginOptions: Partial<SentryWebpackPluginOptions>, userSentryOptions: UserSentryOptions): SentryWebpackPluginOptions;
//# sourceMappingURL=webpack.d.ts.map