Repository navigation
Conversation
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Stale comment
PR Review — Score: 4.7 / 5
This is a well-motivated, intentional breaking change that shifts runtime dependency staging from bundler plugins to application packagers. The implementation is consistent across all three plugins (
!== trueguard), unit tests and integration fixtures are inverted correctly, Forge apps include the requiredpackagerConfig.ignoreoverride, and the newdocs/RUNTIME_DEPENDENCIES.mdplus README/ARCHITECTURE updates give customers a clear migration path. I would approve once the minor documentation gaps below are addressed (or explicitly deferred to the release PR).Why 4.7: Clear rationale, thorough cross-plugin consistency, strong integration coverage (including ASAR assertions and renamed
plugin-copyvariant), and a dedicated Forge setup guide. The PR body explains trade-offs (bundle duplication, package-manager layouts) honestly.Why not 5: A breaking default change should land with a CHANGELOG entry before release, and the README now omits standalone Vite/Webpack plugin snippets that non-Forge users (electron-vite, manual Vite + electron-builder) previously had inline.
Findings
- [Minor] Missing CHANGELOG entry — The
@default falseflip is a breaking change for Forge Vite/Webpack users who relied on implicit plugin copying; add a 💥 Breaking Changes note before the next release.- [Minor] README plugin examples narrowed — Standalone Vite/Webpack setup snippets were removed; only Forge
packagerConfigand an esbuild example remain under “Other packagers.”
Architectural flow
LoadingsequenceDiagram participant Dev as Developer participant Plugin as Bundler plugin participant Packager as Electron packager participant App as Packaged app Note over Plugin,Packager: Previous default copyRuntimeDependencies true Dev->>Plugin: datadogVitePlugin() Plugin->>Plugin: externalize SDK and dd-trace Plugin->>Plugin: copyPackageTree into dist node_modules Packager->>App: package bundler output only Note over Plugin,Packager: New default copyRuntimeDependencies false Dev->>Plugin: datadogVitePlugin() Plugin->>Plugin: externalize SDK and dd-trace only Dev->>Packager: packagerConfig.ignore retains node_modules Packager->>App: prune and stage production dependency treeBefore: Bundler plugins owned dependency staging by default, copying
@datadog/electron-sdkanddd-traceinto the build output’snode_modules. This worked across package-manager layouts but was fragile (pnpm/Yarn PnP) and outside the plugins’ intended scope.After: Packager-owned staging is the default. Forge Vite/Webpack apps override
packagerConfig.ignoreto retain rootnode_modulesalongside.vite/.webpack, letting Electron Packager prune and include the production tree.copyRuntimeDependencies: trueremains as a best-effort fallback.Sent by Cursor Automation: electron-sdk reviews
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ae753b1a66
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ae753b1 to
e6ef345
Compare
|
@codex review |
|
🔗 Commit SHA: f96d7f1 | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
Stale comment
PR Review — Score: 4.8 / 5
Follow-up commits address the documentation gaps from the earlier review: the README again includes Vite and Webpack plugin wiring under “Other packagers,”
docs/RUNTIME_DEPENDENCIES.mdcross-links those examples, anddocs/ARCHITECTURE.mdscopes optional-dependency behavior to plugin-owned staging. The default flip is implemented consistently (copyRuntimeDependencies !== trueacross Vite, Webpack, and esbuild), unit tests and integration fixtures are inverted sensibly (plugin-copyvs packager-owned default), and Forge fixtures include the requiredpackagerConfig.ignoreoverride. I would approve; add a CHANGELOG breaking note before the release (or in the release PR if that is your process). GitLabdd-gitlab/e2ewas still pending when this review was posted.Why 4.8: Clear motivation, thorough customer-facing migration docs, cross-plugin consistency, and strong integration coverage (including the renamed
plugin-copyelectron-builder variant and Forge ASAR assertions described in the PR body).Why not 5:
copyRuntimeDependenciesdefaulting tofalseis a breaking behavioral change for anyone who relied on implicit plugin copying (especially Forge Vite/Webpack withoutpackagerConfig.ignore);CHANGELOG.mddoes not yet document it on this branch.
Findings
- [Minor] Missing CHANGELOG entry — Document the
@default falseflip under Breaking Changes before the next release so upgraders know to configure packagers or opt intocopyRuntimeDependencies: true.- [Nit] Docs index scope —
docs/README.mddescribesRUNTIME_DEPENDENCIES.mdas Forge-only, but the guide also covers other packagers.
Architectural flow
LoadingsequenceDiagram participant Dev as Developer participant Plugin as Bundler plugin participant Packager as Electron packager participant App as Packaged app Note over Plugin,Packager: Previous default copyRuntimeDependencies true Dev->>Plugin: datadogVitePlugin() Plugin->>Plugin: externalize SDK and dd-trace Plugin->>Plugin: copyPackageTree into dist node_modules Packager->>App: package bundler output only Note over Plugin,Packager: New default copyRuntimeDependencies false Dev->>Plugin: datadogVitePlugin() Plugin->>Plugin: externalize SDK and dd-trace only Dev->>Packager: packagerConfig.ignore retains node_modules Packager->>App: prune and stage production dependency treeBefore: Bundler plugins owned runtime dependency staging by default, copying
@datadog/electron-sdkanddd-traceinto the build output’snode_modules—fragile across package-manager layouts and outside the plugins’ intended scope.After: Packager-owned staging is the default. Forge Vite/Webpack apps override
packagerConfig.ignoreto retain rootnode_modulesalongside.vite/.webpack.copyRuntimeDependencies: trueremains a best-effort compatibility fallback.Sent by Cursor Automation: electron-sdk reviews
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
5664c56 to
f96d7f1
Compare
There was a problem hiding this comment.
PR Review — Score: 4.9 / 5
This PR cleanly shifts the default runtime-dependency staging path from bundler plugins to application packagers. The copyRuntimeDependencies !== true guard is applied consistently across Vite, Webpack, and esbuild; unit tests and the inverted plugin-copy integration fixture match the new semantics; Forge fixtures include the required packagerConfig.ignore override; and customer docs (README, docs/RUNTIME_DEPENDENCIES.md, docs/ARCHITECTURE.md, docs index) explain migration and trade-offs. Follow-up commits since the last automation pass restored non-Forge Vite/Webpack examples and broadened the docs index blurb. I would approve; add a CHANGELOG breaking note before release (here or in the release PR if that is your process).
Why 4.9: Intentional, well-documented breaking default with strong cross-plugin consistency and integration coverage (packaged instrumentation paths and ASAR layout assertions described in the PR body).
Why not 5: CHANGELOG.md on this branch still does not record the @default false flip under Breaking Changes, which upgraders need when moving off implicit plugin copying.
Findings
- [Minor] Missing CHANGELOG entry — Document the
copyRuntimeDependenciesdefault change under Breaking Changes before the next release so Forge Vite/Webpack users know to adjustpackagerConfig.ignoreor opt intocopyRuntimeDependencies: true.
Architectural flow
sequenceDiagram
participant Dev as Developer
participant Plugin as Bundler plugin
participant Packager as Electron packager
participant App as Packaged app
Note over Plugin,Packager: Previous default copyRuntimeDependencies true
Dev->>Plugin: datadogVitePlugin()
Plugin->>Plugin: externalize SDK and dd-trace
Plugin->>Plugin: copyPackageTree into dist node_modules
Packager->>App: package bundler output only
Note over Plugin,Packager: New default copyRuntimeDependencies false
Dev->>Plugin: datadogVitePlugin()
Plugin->>Plugin: externalize SDK and dd-trace only
Dev->>Packager: packagerConfig.ignore retains node_modules
Packager->>App: prune and stage production dependency tree
Before: Bundler plugins owned runtime dependency staging by default, copying @datadog/electron-sdk and dd-trace into the build output’s node_modules—fragile across package-manager layouts and outside the plugins’ intended scope.
After: Packager-owned staging is the default. Forge Vite/Webpack apps override packagerConfig.ignore to retain root node_modules alongside .vite/.webpack. copyRuntimeDependencies: true remains a best-effort compatibility fallback.
Sent by Cursor Automation: electron-sdk reviews
| * compatibility fallback only when the packager cannot do so. | ||
| * | ||
| * @default true | ||
| * @default false |
There was a problem hiding this comment.
[Minor] Release note — This @default false change is breaking for anyone who relied on implicit plugin copying (especially Forge Vite/Webpack without packagerConfig.ignore). Please add a 💥 Breaking Changes entry to CHANGELOG.md before the next release, or confirm it will land in the release PR.
| * 3. Optionally copies dd-trace and @datadog/electron-sdk into the build | ||
| * output's node_modules when the application packager does not stage them. |
There was a problem hiding this comment.
💬 suggestion: could it be interesting to mention that it is achieved with copyRuntimeDependencies: true? since the option is not in the plugin jsdoc anymore
same with webpack plugin but not with esbuild plugin.
Should we not have the same doc structure in esbuild plugin?
| **Vite** (including Electron Forge with Vite and electron-vite): | ||
| ##### Electron Forge | ||
|
|
||
| Keep `copyRuntimeDependencies` disabled. Configure Forge to package root `node_modules` alongside its |
There was a problem hiding this comment.
💬 suggestion: Keep copyRuntimeDependencies disabled. is the first mention of copyRuntimeDependencies in this doc. Maybe adding a paragraph in bundler plugins section could help understanding the purpose of this option before mentioning it.
| it('is delegated to the packager by default for webpack', () => { | ||
| let defaultAfterEmitCalls = 0; | ||
| new DatadogWebpackPlugin().apply( | ||
| createWebpackCompiler(() => { | ||
| defaultAfterEmitCalls += 1; | ||
| }) | ||
| ); | ||
| expect(defaultAfterEmitCalls).toBe(1); | ||
| expect(defaultAfterEmitCalls).toBe(0); | ||
|
|
||
| let managedAfterEmitCalls = 0; | ||
| new DatadogWebpackPlugin({ copyRuntimeDependencies: false }).apply( | ||
| let pluginCopyAfterEmitCalls = 0; | ||
| new DatadogWebpackPlugin({ copyRuntimeDependencies: true }).apply( |
There was a problem hiding this comment.
Here it is not delegated to the packager though, no?


Motivation
Currently, Electron Forge’s Vite and Webpack plugins configure Electron Packager to include only the contents of
.viteor.webpackin the packaged application.This leads to issues with externalized dependencies such as
@datadog/electron-sdkanddd-trace, since these dependencies cannot currently be safely bundled and must remain available at runtime.To address this limitation, we previously handled dependency copying inside the Datadog bundler plugins. This minimized the actions required from users and simplified SDK setup.
The issue is that dependency management is complex, with several package managers and installation layouts, including npm, Yarn, Yarn Plug’n’Play, and pnpm. Supporting all these layouts reliably has proven difficult and is beyond the intended scope of these bundler plugins.
As such, the goal of this PR is to change the default value of the
copyRuntimeDependenciesoption in the Vite, Webpack, and esbuild plugins fromtrue, where the SDK handles dependency copying, tofalse, where dependency staging becomes the responsibility of the chosen application packager.copyRuntimeDependencies: trueremains available as a best-effort compatibility fallback for setups where the packager cannot stage external dependencies.A couple of things should be considered. Out-of-the-box production dependency staging is supported by
electron-builderand by plain Electron Forge. Forge’s core packaging flow, provided by@electron-forge/core, delegates application assembly and production dependency pruning to@electron/packager. These are parts of the same Forge packaging flow rather than separate packaging configurations.However, Forge’s
@electron-forge/plugin-viteand@electron-forge/plugin-webpackintegrations normally restrict the packaged application contents to.viteand.webpack, respectively. Webpack can relocate modules it processes, but the SDK anddd-traceare deliberately externalized and excluded from that relocation.For these scenarios, users must make a small change to
packagerConfig.ignorein theirforge.configso that Forge also stages production dependencies from the application’s rootnode_modules. The required configuration is documented inREADME.md.The Forge Vite and Webpack integration fixtures use this configuration with
copyRuntimeDependenciesomitted. Their packaged instrumentation tests verify startup instrumentation, renderer error propagation, main-process resource events and trace spans, custom-session preload injection, and crash reporting. The packaged ASAR archives were also verified to contain both@datadog/electron-sdkanddd-trace.This approach also has a downside. Electron Packager prunes development dependencies, but it cannot determine which production dependencies have already been included in the Vite or Webpack bundles. Consequently, the packaged application may retain production dependencies that were already bundled, potentially increasing its overall size.
Applications can reduce this duplication by keeping only genuine runtime dependencies in
dependenciesand moving packages that are fully bundled intodevDependencies.copyRuntimeDependencies: truealso remains available as a best-effort alternative, although it is known to behave differently across package-manager installation layouts.Electron Forge is working on improved handling of native external dependencies in the Vite plugin through electron/forge#4232. However, that PR is currently a draft, is Vite-specific, and focuses on native Node modules. It does not address the Webpack plugin or fully remove the need for this workaround for the SDK and
dd-trace. Until equivalent support is merged and released, we need to support the approach described above.Changes
Test instructions
Checklist