feat: devtron integration - #4344
Open
erickzhao wants to merge 1 commit into
Open
Conversation
Adds a `devtron: true` config option to @electron-forge/plugin-webpack and @electron-forge/plugin-vite that installs the @electron/devtron DevTools extension into the app during `electron-forge start`. The bootstrap is prepended as a raw banner to the compiled main process bundle in development only (webpack BannerPlugin / Rollup output.banner), so the bundler never parses it and `@electron/devtron` resolves from the app's node_modules at runtime. The snippet guards against packaged apps, non-main Electron processes, and ESM output without `require`. A shared helper in @electron-forge/core-utils validates that @electron/devtron is installed in the app (actionable error otherwise) and that the app's Electron version is >= 36 (warn and skip otherwise). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnzP6e9JFCCaDFgbpiWVms
BlackHole1
approved these changes
Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for automatically injecting the Devtron DevTools extension into Electron apps during development when using the Webpack or Vite build plugins.
Changes
Core Utilities (
packages/utils/core-utils)devtron.tsmodule with:getDevtronBootstrapCode(): Generates safe CommonJS bootstrap code that installs Devtron as a DevTools extension in the main processcanInjectDevtron(): Validates that@electron/devtronis installed and the Electron version is >= 36.0.0 (required for the DevTools extension API)devtron.spec.tsWebpack Plugin (
packages/plugin/webpack)devtronconfiguration option toWebpackPluginConfigWebpackConfigGenerator.getMainConfig()to inject the Devtron bootstrap code as a webpackBannerPluginwhen:devtronoption is enabledcanInjectDevtron())Vite Plugin (
packages/plugin/vite)devtronconfiguration option toVitePluginConfigVitePluginto:preStarthookdevtronEnabledflagvite.main.config.tsto inject the bootstrap code as a Rollup banner and mark@electron/devtronas external when enabledBehavior
electron-forge start, never in packaged buildsrequireis unavailable@electron/devtronis not installed, an error is thrown with installation instructionsTesting
devtronmodule covering bootstrap code validity, version checking, and installation detectionhttps://claude.ai/code/session_01PnzP6e9JFCCaDFgbpiWVms