Summary
Webpack supports three Electron target contexts in lib/config/target.js and lib/electron/ElectronTargetPlugin.js:
electron-main
electron-preload
electron-renderer
At the moment, there is only a visible config case for electron-renderer under test/configCases/target/electron-renderer.
That leaves electron-main and electron-preload with little or no dedicated integration-style config case coverage, even though they affect target properties, resolve behavior, and externals handling differently.
Proposal Description
Add dedicated config case tests for:
test/configCases/target/electron-main
test/configCases/target/electron-preload
These tests should validate behavior specific to those target contexts and help ensure the target/runtime behavior remains correct when Electron-related logic changes.
Suggested Scope
Some candidate assertions for the new config cases:
electron-main
- should not behave like a browser target
- should not prefer the
browser field in package resolution
- should preserve Node/Electron-style behavior expected in main context
electron-preload
- should behave differently from
electron-renderer
- should not incorrectly enable browser-style resolution behavior
- should preserve preload-specific environment assumptions
Why this is useful
This would improve test coverage around Electron targets and make future work related to target/runtime behavior easier and safer, especially as Electron support has been mentioned as one of the remaining unresolved target areas.
Related Code
lib/config/target.js
lib/electron/ElectronTargetPlugin.js
- existing test:
test/configCases/target/electron-renderer
Related Context
This is adjacent to the target/runtime area and may also be useful groundwork for broader work around target compatibility and Universal Targets.
Summary
Webpack supports three Electron target contexts in
lib/config/target.jsandlib/electron/ElectronTargetPlugin.js:electron-mainelectron-preloadelectron-rendererAt the moment, there is only a visible config case for
electron-rendererundertest/configCases/target/electron-renderer.That leaves
electron-mainandelectron-preloadwith little or no dedicated integration-style config case coverage, even though they affect target properties, resolve behavior, and externals handling differently.Proposal Description
Add dedicated config case tests for:
test/configCases/target/electron-maintest/configCases/target/electron-preloadThese tests should validate behavior specific to those target contexts and help ensure the target/runtime behavior remains correct when Electron-related logic changes.
Suggested Scope
Some candidate assertions for the new config cases:
electron-mainbrowserfield in package resolutionelectron-preloadelectron-rendererWhy this is useful
This would improve test coverage around Electron targets and make future work related to target/runtime behavior easier and safer, especially as Electron support has been mentioned as one of the remaining unresolved target areas.
Related Code
lib/config/target.jslib/electron/ElectronTargetPlugin.jstest/configCases/target/electron-rendererRelated Context
This is adjacent to the target/runtime area and may also be useful groundwork for broader work around target compatibility and Universal Targets.