With `use_execroot_entry_point = False`, we want Webpack config files to be
built for the exec platform. However, this poses a problem for `mode` and
`devtool`, which are derived from the compilation mode and are currently baked
into the base config file. If we build that config file for the exec platform,
then it cannot be customized based on the target platform compilation mode.
This commit solves that problem by passing this information via `WEBPACK_MODE`
and `WEBPACK_DEVTOOL` environment variables. This way we can get the
information we need about the compilation mode without having to hard-code it
in the generated base config.
Importantly, user-provided configs can still override mode and devtool as
expected, and there is even an existing test for this in
`webpack/tests/devtool-override`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
With
use_execroot_entry_point = False, we want Webpack config files to be built for the exec platform. However, this poses a problem formodeanddevtool, which are derived from the compilation mode and are currently baked into the base config file. If we build that config file for the exec platform, then it cannot be customized based on the target platform compilation mode.This commit solves that problem by passing this information via
WEBPACK_MODEandWEBPACK_DEVTOOLenvironment variables. This way we can get the information we need about the compilation mode without having to hard-code it in the generated base config.Importantly, user-provided configs can still override mode and devtool as expected, and there is even an existing test for this in
webpack/tests/devtool-override.Changes are visible to end-users: no, unless you go out of your way to look at these environment variables
Test plan