{"id":19054251,"url":"https://github.com/datadog/build-plugins","last_synced_at":"2026-02-26T00:04:13.077Z","repository":{"id":41957401,"uuid":"257533548","full_name":"DataDog/build-plugins","owner":"DataDog","description":"A set of universal bundler plugins to interact with Datadog directly from your builds.","archived":false,"fork":false,"pushed_at":"2025-05-14T08:21:37.000Z","size":494826,"stargazers_count":109,"open_issues_count":5,"forks_count":7,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-14T09:36:46.927Z","etag":null,"topics":["build","bundler-plugin","esbuild-plugin","metrics","monitoring","rollup-plugin","rspack-plugin","vite-plugin","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataDog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-21T08:42:37.000Z","updated_at":"2025-05-07T08:59:09.000Z","dependencies_parsed_at":"2023-11-10T14:26:33.516Z","dependency_job_id":"c86d90fe-9503-46cd-99a2-30dc18ca6ed9","html_url":"https://github.com/DataDog/build-plugins","commit_stats":null,"previous_names":["datadog/build-plugins"],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fbuild-plugins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fbuild-plugins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fbuild-plugins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataDog%2Fbuild-plugins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataDog","download_url":"https://codeload.github.com/DataDog/build-plugins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509478,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build","bundler-plugin","esbuild-plugin","metrics","monitoring","rollup-plugin","rspack-plugin","vite-plugin","webpack-plugin"],"created_at":"2024-11-08T23:37:29.887Z","updated_at":"2026-02-26T00:04:08.032Z","avatar_url":"https://github.com/DataDog.png","language":"TypeScript","readme":"# Datadog Build Plugins \u003c!-- #omit in toc --\u003e\n\nA set of bundler plugins for \u003cimg src=\"packages/assets/src/webpack.svg\" alt=\"Webpack\" width=\"17\" /\u003e Webpack, \u003cimg src=\"packages/assets/src/vite.svg\" alt=\"Vite\" width=\"17\" /\u003e Vite, \u003cimg src=\"packages/assets/src/esbuild.svg\" alt=\"ESBuild\" width=\"17\" /\u003e ESBuild and \u003cimg src=\"packages/assets/src/rollup.svg\" alt=\"Rollup\" width=\"17\" /\u003e Rollup, to interact with Datadog directly from your builds.\n\n\u003e [!NOTE]\n\u003e If you want to upgrade from v1 to v2, please follow our [migration guide](/MIGRATIONS.md#v1-to-v2).\n\n## Table of content \u003c!-- #omit in toc --\u003e\n\n\u003c!-- This is auto generated with yarn cli integrity --\u003e\n\n\u003c!-- #toc --\u003e\n-   [Bundler Plugins](#bundler-plugins)\n    -   [ESBuild](#-esbuild)\n    -   [Rollup](#-rollup)\n    -   [Vite](#-vite)\n    -   [Webpack](#-webpack)\n-   [Features](#features)\n    -   [RUM](#rum----)\n    -   [Telemetry](#telemetry----)\n-   [Configuration](#configuration)\n    -   [`auth.apiKey`](#authapikey)\n    -   [`logLevel`](#loglevel)\n    -   [`customPlugins`](#customplugins)\n-   [Contributing](#contributing)\n-   [License](#license)\n\u003c!-- #toc --\u003e\n\n## Bundler Plugins\n\n\u003c!-- #list-of-bundlers --\u003e\n### \u003cimg src=\"packages/assets/src/esbuild.svg\" alt=\"ESBuild\" width=\"17\" /\u003e ESBuild\n\n`@datadog/esbuild-plugin`\n\n#### Installation\n-   Yarn\n\n```bash\nyarn add -D @datadog/esbuild-plugin\n```\n\n-   NPM\n\n```bash\nnpm install --save-dev @datadog/esbuild-plugin\n```\n\n\n#### Usage\n```js\nconst { datadogEsbuildPlugin } = require('@datadog/esbuild-plugin');\n\nrequire('esbuild').build({\n    plugins: [\n        datadogEsbuildPlugin({\n            // Configuration\n        }),\n    ],\n});\n```\n\n\u003e [!TIP]\n\u003e It is important to have the plugin in the first position in order to report every other plugins.\n\n\n\u003ckbd\u003e[📝 More details ➡️](/packages/published/esbuild-plugin#readme)\u003c/kbd\u003e\n\n### \u003cimg src=\"packages/assets/src/rollup.svg\" alt=\"Rollup\" width=\"17\" /\u003e Rollup\n\n`@datadog/rollup-plugin`\n\n#### Installation\n-   Yarn\n\n```bash\nyarn add -D @datadog/rollup-plugin\n```\n\n-   NPM\n\n```bash\nnpm install --save-dev @datadog/rollup-plugin\n```\n\n\n#### Usage\nInside your `rollup.config.js`.\n\n```js\nimport { datadogRollupPlugin } from '@datadog/rollup-plugin';\n\nexport default {\n    plugins: [\n        datadogRollupPlugin({\n            // Configuration\n        }),\n    ],\n};\n```\n\n\u003e [!TIP]\n\u003e It is important to have the plugin in the first position in order to report every other plugins.\n\n\n\u003ckbd\u003e[📝 More details ➡️](/packages/published/rollup-plugin#readme)\u003c/kbd\u003e\n\n### \u003cimg src=\"packages/assets/src/vite.svg\" alt=\"Vite\" width=\"17\" /\u003e Vite\n\n`@datadog/vite-plugin`\n\n#### Installation\n-   Yarn\n\n```bash\nyarn add -D @datadog/vite-plugin\n```\n\n-   NPM\n\n```bash\nnpm install --save-dev @datadog/vite-plugin\n```\n\n\n#### Usage\nInside your `vite.config.js`.\n\n```js\nimport { datadogVitePlugin } from '@datadog/vite-plugin';\nimport { defineConfig } from 'vite'\n\nexport default defineConfig({\n  plugins: [\n        datadogVitePlugin({\n            // Configuration\n        }),\n    ],\n};\n```\n\n\u003e [!TIP]\n\u003e It is important to have the plugin in the first position in order to report every other plugins.\n\n\n\u003ckbd\u003e[📝 More details ➡️](/packages/published/vite-plugin#readme)\u003c/kbd\u003e\n\n### \u003cimg src=\"packages/assets/src/webpack.svg\" alt=\"Webpack\" width=\"17\" /\u003e Webpack\n\n`@datadog/webpack-plugin`\n\n#### Installation\n-   Yarn\n\n```bash\nyarn add -D @datadog/webpack-plugin\n```\n\n-   NPM\n\n```bash\nnpm install --save-dev @datadog/webpack-plugin\n```\n\n\n#### Usage\nInside your `webpack.config.js`.\n\n```js\nconst { datadogWebpackPlugin } = require('@datadog/webpack-plugin');\n\nmodule.exports = {\n    plugins: [\n        datadogWebpackPlugin({\n            // Configuration\n        }),\n    ],\n};\n```\n\n\u003e [!TIP]\n\u003e It is important to have the plugin in the first position in order to report every other plugins.\n\n\n\u003ckbd\u003e[📝 More details ➡️](/packages/published/webpack-plugin#readme)\u003c/kbd\u003e\n\u003c!-- #list-of-bundlers --\u003e\n\n## Features\n\n\u003c!-- #list-of-packages --\u003e\n### RUM \u003cimg src=\"packages/assets/src/esbuild.svg\" alt=\"ESBuild\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/rollup.svg\" alt=\"Rollup\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/vite.svg\" alt=\"Vite\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/webpack.svg\" alt=\"Webpack\" width=\"17\" /\u003e\n\n\u003e Interact with our Real User Monitoring product (RUM) in Datadog directly from your build system.\n\n```typescript\ndatadogWebpackPlugin({\n    rum?: {\n        disabled?: boolean,\n        sourcemaps?: {\n            bailOnError?: boolean,\n            dryRun?: boolean,\n            intakeUrl?: string,\n            maxConcurrency?: number,\n            minifiedPathPrefix: string,\n            releaseVersion: string,\n            service: string,\n        },\n    }\n});\n```\n\n\u003ckbd\u003e[📝 Full documentation ➡️](/packages/plugins/rum#readme)\u003c/kbd\u003e\n\n### Telemetry \u003cimg src=\"packages/assets/src/esbuild.svg\" alt=\"ESBuild\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/rollup.svg\" alt=\"Rollup\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/vite.svg\" alt=\"Vite\" width=\"17\" /\u003e \u003cimg src=\"packages/assets/src/webpack.svg\" alt=\"Webpack\" width=\"17\" /\u003e\n\n\u003e Display and send telemetry data as metrics to Datadog.\n\n```typescript\ndatadogWebpackPlugin({\n    telemetry?: {\n        disabled?: boolean,\n        enableTracing?: boolean,\n        endPoint?: string,\n        output?: boolean\n            | string\n            | {\n                destination: string,\n                timings?: boolean,\n                metrics?: boolean,\n            },\n        prefix?: string,\n        tags?: string[],\n        timestamp?: number,\n        filters?: ((metric: Metric) =\u003e Metric | null)[],\n    }\n});\n```\n\n\u003ckbd\u003e[📝 Full documentation ➡️](/packages/plugins/telemetry#readme)\u003c/kbd\u003e\n\u003c!-- #list-of-packages --\u003e\n\n## Configuration\n\n\u003c!-- #full-configuration --\u003e\n```typescript\n{\n    auth?: {\n        apiKey?: string;\n    };\n    customPlugins?: (options: Options, context: GlobalContext) =\u003e UnpluginPlugin[];\n    logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'none';\n    rum?: {\n        disabled?: boolean;\n        sourcemaps?: {\n            bailOnError?: boolean;\n            dryRun?: boolean;\n            intakeUrl?: string;\n            maxConcurrency?: number;\n            minifiedPathPrefix: string;\n            releaseVersion: string;\n            service: string;\n        };\n    };\n    telemetry?: {\n        disabled?: boolean;\n        enableTracing?: boolean;\n        endPoint?: string;\n        output?: boolean\n            | string\n            | {\n                destination: string;\n                timings?: boolean;\n                metrics?: boolean;\n            };\n        prefix?: string;\n        tags?: string[];\n        timestamp?: number;\n        filters?: ((metric: Metric) =\u003e Metric | null)[];\n    };\n}\n```\n\u003c!-- #full-configuration --\u003e\n\n### `auth.apiKey`\n\n\u003e default `null`\n\nIn order to interact with Datadog, you have to use [your own API Key](https://app.datadoghq.com/organization-settings/api-keys).\n\n### `logLevel`\n\n\u003e default: `'warn'`\n\nWhich level of log do you want to show.\n\n### `customPlugins`\n\n\u003e default: `[]`\n\nThis is a way for you to inject any [Unplugin Plugin](https://unplugin.unjs.io/guide/) you want.\n\nIt's particularly useful to use our global, shared context of the main plugin.\n\nOr to prototype some new plugins in the same environment.\n\n```typescript\n{\n    customPlugins: (options, context) =\u003e [{\n        name: 'my-custom-plugin',\n        buildStart() {\n            console.log('Hello world');\n        },\n    }];\n}\n```\n\nYour function will receive two arguments:\n\n- `options`: The options you passed to the main plugin (including your custom plugins).\n- `context`: The global context shared accross our plugin.\n\n\u003c!-- #global-context-type --\u003e\n```typescript\ntype GlobalContext = {\n    // Mirror of the user's config.\n    auth?: {\n        apiKey?: string;\n    };\n    // More details on the currently running bundler.\n    bundler: {\n        name: string;\n        fullName: string; // Including its variant.\n        outDir: string; // Output directory\n        // Added in `buildStart`.\n        rawConfig?: any;\n        variant: string; // Major version of the bundler (webpack 4, webpack 5), empty string otherwise.\n    };\n    // Added in `writeBundle`.\n    build: {\n        errors: string[];\n        warnings: string[];\n        // The list of entries used in the build.\n        entries ? : {\n            filepath: string;\n            inputs: Input[],\n            name: string;\n            outputs: Output[]\n            size: number;\n            type: string,\n        } [];\n        // The list of inputs used in the build.\n        inputs ? : {\n            filepath: string;\n            dependencies: Input[];\n            dependents: Input[]\n            name: string;\n            size: number;\n            type: string,\n        } [];\n        // The list of outputs generated by the build.\n        outputs ? : {\n            filepath: string;\n            name: string;\n            size: number;\n            type: string,\n            // Sourcemaps will use Outputs as their Inputs.\n            inputs: (Input | Output)[]\n        } [];\n        start?: number;\n        end?: number;\n        duration?: number;\n        writeDuration?: number;\n    };\n    cwd: string;\n    getLogger: (name: string) =\u003e [Logger](/packages/factory/src/helpers.ts);\n    // Added in `buildStart`.\n    git?: {\n        hash: string;\n        remote: string;\n        trackedFilesMatcher: [TrackedFilesMatcher](/packages/plugins/git/trackedFilesMatcher.ts);\n    };\n    inject: (item: { type: 'file' | 'code'; value: string; fallback?: @self }) =\u003e void;\n    start: number;\n    version: string;\n}\n```\n\n\u003e [!NOTE]\n\u003e Some parts of the context are only available after certain hooks:\n\u003e   - `context.bundler.rawConfig` is added in the `buildStart` hook.\n\u003e   - `context.build.*` is populated in the `writeBundle` hook.\n\u003e   - `context.git.*` is populated in the `buildStart` hook.\n\n\u003c!-- #global-context-type --\u003e\n\nYour function will need to return an array of [Unplugin Plugins definitions](https://unplugin.unjs.io/guide/#supported-hooks).\n\n## Contributing\n\nCheck out [CONTRIBUTING.md](/CONTRIBUTING.md) for more information about how to work with the build-plugins ecosystem.\n\n## License\n\n[MIT](/LICENSE)\n\n\u003ckbd\u003e[Back to top :arrow_up:](#top)\u003c/kbd\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fbuild-plugins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatadog%2Fbuild-plugins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatadog%2Fbuild-plugins/lists"}