A set of bundler plugins for:
esbuild
@datadog/esbuild-plugin
Rollup
@datadog/rollup-plugin
Rspack
@datadog/rspack-plugin
Vite
@datadog/vite-plugin
Webpack
@datadog/webpack-plugin
To interact with Datadog directly from your builds.
Note
If you want to upgrade from v1 to v2, please follow our migration guide.
- Yarn
yarn add -D @datadog/{{bundler}}-plugin
- NPM
npm install --save-dev @datadog/{{bundler}}-plugin
In your bundler's configuration file:
const { datadog{{Bundler}}Plugin } = require('@datadog/{{bundler}}-plugin');
export const config = {
plugins: [
datadog{{Bundler}}Plugin({
// Configuration
}),
],
};
Tip
It is best to have the plugin in the first position in order to report every other plugins.
Follow the specific documentation for each bundler:
esbuild
@datadog/esbuild-plugin
Rollup
@datadog/rollup-plugin
Rspack
@datadog/rspack-plugin
Vite
@datadog/vite-plugin
Webpack
@datadog/webpack-plugin
Full configuration object
{
auth?: {
apiKey?: string;
};
customPlugins?: (options: Options, context: GlobalContext, log: Logger) => UnpluginPlugin[];
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'none';
errorTracking?: {
disabled?: boolean;
sourcemaps?: {
bailOnError?: boolean;
disableGit?: boolean;
dryRun?: boolean;
intakeUrl?: string;
maxConcurrency?: number;
minifiedPathPrefix: string;
releaseVersion: string;
service: string;
};
};
telemetry?: {
disabled?: boolean;
enableTracing?: boolean;
endPoint?: string;
output?: boolean
| string
| {
destination: string;
timings?: boolean;
metrics?: boolean;
};
prefix?: string;
tags?: string[];
timestamp?: number;
filters?: ((metric: Metric) => Metric | null)[];
};
}
default
null
In order to interact with Datadog, you have to use your own API Key.
default
null
In order to interact with Datadog, you have to use your own Application Key.
default:
false
Disable the Git plugin if you don't want to use it.
For instance if you see a Error: No git remotes available
error.
default:
'warn'
Which level of log do you want to show.
default:
[]
This is a way for you to inject any Unplugin Plugin you want.
It's particularly useful to use our global, shared context of the main plugin.
And to prototype some new plugins in the same environment.
{
customPlugins: (options, context) => {
const name = 'my-custom-plugin';
const log = context.getLogger(name);
return [{
name,
buildStart() {
log.info('Hello world');
},
}]
};
}
Your function will receive three arguments:
options
: The options you passed to the main plugin (including your custom plugins).context
: The global context shared accross our plugin.
The context
is a shared object that is mutated during the build process.
Full context object
type GlobalContext = { // Mirror of the user's config. auth?: { apiKey?: string; }; // More details on the currently running bundler. bundler: BundlerReport // Added in `writeBundle`. build: BuildReport cwd: string; getLogger: (name: string) => Logger // Added in `buildStart`. git?: Git inject: Injection start: number; version: string; }
Interact with Error Tracking directly from your build system.
Configuration
datadogWebpackPlugin({
errorTracking?: {
disabled?: boolean,
sourcemaps?: {
bailOnError?: boolean,
disableGit?: boolean,
dryRun?: boolean,
intakeUrl?: string,
maxConcurrency?: number,
minifiedPathPrefix: string,
releaseVersion: string,
service: string,
},
}
});
Display and send telemetry data as metrics to Datadog.
Configuration
datadogWebpackPlugin({
telemetry?: {
disabled?: boolean,
enableTracing?: boolean,
endPoint?: string,
output?: boolean
| string
| {
destination: string,
timings?: boolean,
metrics?: boolean,
},
prefix?: string,
tags?: string[],
timestamp?: number,
filters?: ((metric: Metric) => Metric | null)[],
}
});
Check out CONTRIBUTING.md for more information about how to work with the build-plugins ecosystem.