Repository navigation
refactor(react): use webpack-bundler/webpack-dev-server instead of WebpackMain aspect - #10610
Conversation
…ver instead of WebpackMain Replaces this.webpack.createBundler/createDevServer with the standalone WebpackBundler/WebpackDevServer packages, decoupling the react env from the WebpackMain aspect (ReactEnv now depends on PubsubMain instead). Adds compensating transformers to keep the emitted webpack config identical to what WebpackMain used to produce, since the packages' base config factories have drifted from teambit.webpack/webpack's own factories.
PR Summary by QodoRefactor ReactEnv to use webpack-bundler/dev-server packages (drop WebpackMain)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1. Missing workspace package path
|
| raw.devServer.historyApiFallback = { | ||
| ...raw.devServer.historyApiFallback, | ||
| index: resolve(workspace.path, `${devServerContext.rootPath}/${devServerContext.publicPath}`), | ||
| }; |
There was a problem hiding this comment.
1. Bad devserver index path 🐞 Bug ≡ Correctness
alignDevServerWithWorkspaceDefaults computes historyApiFallback.index via resolve(workspace.path,
${rootPath}/${publicPath}); when rootPath is an empty string, the interpolated string starts with
'/', so path.resolve ignores workspace.path and produces an absolute '/public/<app>' path. ReactApp
constructs a DevServerContext with rootPath: '' and publicPath: public/${name}, so this will point
the fallback index outside the workspace and can break dev-server history fallback routing.
Agent Prompt
## Issue description
`alignDevServerWithWorkspaceDefaults()` builds `devServer.historyApiFallback.index` using a template string `${rootPath}/${publicPath}` and then `path.resolve(workspace.path, ...)`. When `rootPath === ''` (which happens for ReactApp), the template string becomes `/${publicPath}` and `path.resolve()` treats it as absolute, ignoring `workspace.path`.
## Issue Context
This transformer is injected into `ReactEnv.getDevServer()` and is therefore applied to ReactApp dev-server contexts as well.
## Fix Focus Areas
- scopes/react/react/react.env.ts[114-135]
## How to fix
Compute the resolved path without introducing a leading slash when `rootPath` is empty (and keep current behavior when `publicPath` begins with a separator for component previews). For example:
- Build `publicDirectory` conditionally:
- if `devServerContext.rootPath` is truthy: `${rootPath}/${publicPath}` (current behavior)
- else: `${publicPath}` (no prefixed `/`)
- Then `index: resolve(workspace.path, publicDirectory)`
Optionally, add a small normalization helper for `publicPath` when `rootPath` is empty (e.g. strip leading `/` or `\\`) to avoid absolute-path semantics.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
…e packages Replaces the core teambit.webpack/webpack aspect's internal implementations of generateAddAliasesFromPeersTransformer, generateExternalsTransformer, resolvePeerToDirOrFile/resolvePeerToFile, and WebpackBitReporterPlugin with re-exports from the new standalone @teambit/webpack.transformers.*, @teambit/webpack.modules.resolve-peer, and @teambit/webpack.plugins.webpack-bit-reporter-plugin packages, removing the duplicated logic. Public API (import paths and names from @teambit/webpack) is unchanged. Validated WebpackMain.createBundler/createDevServer still produce byte-identical config to before the change.
| components/sandbox/webpack-poc: | ||
| dependencies: | ||
| '@testing-library/react': | ||
| specifier: ^14.3.1 |
There was a problem hiding this comment.
1. Missing workspace package path 🐞 Bug ☼ Reliability
pnpm-lock.yaml adds a workspace importer and multiple file:components/sandbox/webpack-poc resolutions, but components/sandbox/webpack-poc is not present in this repo checkout; this can make pnpm install / workspace linking fail when it tries to resolve that directory package.
Agent Prompt
### Issue description
`pnpm-lock.yaml` now includes a local workspace importer and `file:` resolutions for `components/sandbox/webpack-poc`, but that directory/package is not present in the repository checkout. This can cause `pnpm install` (especially `--frozen-lockfile`) to fail when pnpm attempts to resolve/link the missing directory.
### Issue Context
The lockfile declares `components/sandbox/webpack-poc` under `importers:` and also declares a workspace package `@sandbox/webpack-test.sandbox.webpack-poc@file:components/sandbox/webpack-poc` plus snapshots for it.
### Fix Focus Areas
- pnpm-lock.yaml[3821-3835]
- pnpm-lock.yaml[31976-31982]
- pnpm-lock.yaml[56638-56658]
### What to do
- If this sandbox package was added unintentionally: regenerate the lockfile without it (remove the importer + package + snapshots entries by re-running pnpm from a clean tree, then commit the updated lockfile).
- If it *is* intended: add/commit the missing `components/sandbox/webpack-poc` directory (at minimum its `package.json` and sources) so the `file:` resolution is valid.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 694a299 |
| [email protected]: | ||
| resolution: {integrity: sha512-U9/cvLzxObKNEZ9+TtdqrHM5/9z3lgl2c+c4BzbqGxFQvQvBAq87yql5A8pQ+rrMbS496MZJeF5enVBndIy2hw==} | ||
| engines: {node: '>=10.13.0'} | ||
| hasBin: true |
There was a problem hiding this comment.
1. Duplicate webpack versions 🐞 Bug ⚙ Maintainability
The lockfile now installs [email protected] in addition to the existing [email protected], driven by @teambit/webpack.plugins.webpack-bit-reporter-plugin depending on webpack. This increases install size and creates a higher risk of hard-to-debug incompatibilities when different parts of the toolchain end up importing different webpack copies.
Agent Prompt
### Issue description
`pnpm-lock.yaml` now includes two webpack versions (`5.109.2` and `5.97.1`). This is introduced via the new `@teambit/[email protected]` snapshot resolving `[email protected]`, while the repo continues to use `[email protected]` elsewhere.
### Issue Context
Keeping a single webpack version across the workspace reduces install footprint and avoids subtle incompatibilities from multiple webpack copies coexisting.
### Fix Focus Areas
- package.json[65-69]
- pnpm-lock.yaml[49647-49663]
- pnpm-lock.yaml[103074-103077]
### Suggested fix
1. Decide the intended webpack version for the workspace (either keep `5.97.1` or move everything to `5.109.2`).
2. Add a pnpm override in the root `package.json` (under the existing `"pnpm"` section) to force a single `webpack` version, e.g.:
- `"pnpm": { "overrides": { "webpack": "5.97.1" } }`
(or `5.109.2`, as chosen).
3. Re-run `pnpm install` to regenerate `pnpm-lock.yaml` and confirm only one webpack version remains.
4. Sanity-check `bit build` / `bit start` to ensure the override doesn’t break the new dev-server/bundler packages.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit d7e698c |
| // the package's base config sets `output.pathinfo` explicitly; the workspace's own factory | ||
| // leaves it unset and relies on webpack's per-mode default instead. | ||
| if (raw.output) delete raw.output.pathinfo; | ||
| raw.stats = { ...raw.stats, logging: 'error' }; | ||
| const componentPathsRegExps = workspace.getComponentPathsRegExps(); |
There was a problem hiding this comment.
1. Dev-server stats details lost 🐞 Bug ◔ Observability
alignDevServerWithWorkspaceDefaults() only forces stats.logging = 'error' and doesn’t ensure stats.errorDetails = true (which the previous WebpackMain dev-server config always set), so if the new base dev-server config omits it the emitted config will provide less detailed webpack error output during bit start. This is a behavior drift relative to the stated goal of keeping the emitted config identical.
Agent Prompt
### Issue description
`alignDevServerWithWorkspaceDefaults()` updates `raw.stats` but does not guarantee the legacy `stats.errorDetails: true` setting that the previous `WebpackMain.createDevServer()` base config always applied. If the new standalone dev-server base config doesn't set `errorDetails`, webpack error output will lose useful detail.
### Issue Context
Legacy dev-server config (`scopes/webpack/webpack/config/webpack.dev.config.ts`) always set:
- `stats.errorDetails: true`
- `stats.logging: 'error'`
### Fix Focus Areas
- scopes/react/react/react.env.ts[118-123]
### Suggested fix
Update the transformer to explicitly set `errorDetails: true` while preserving any existing object stats:
- If `raw.stats` is an object: merge in `{ errorDetails: true, logging: 'error' }`.
- If `raw.stats` is not an object (e.g. `false`/string), replace it with an object that includes at least `{ errorDetails: true, logging: 'error' }` (or preserve the previous non-object value if you intentionally want it).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
Code review by qodo was updated up to the latest commit 7c51a0c |
The lockfile committed alongside the exclude-node-modules-js addition was a full re-resolution: it moved several hundred packages within their ranges, among them @bitdev/react.generators.react-templates 6.0.3 -> 6.0.9, which no longer exports ReactWebpackTemplate. scopes/react/react/react.templates.ts imports it, so `tsc --noEmit` and the `declaration` build task both failed - that is the whole of generate_and_check_types and bit_pr going red. Regenerated from master's lockfile instead, so the only package this PR adds is @teambit/[email protected]. The rest of the diff is pnpm re-syncing importers with master's tree - #10610 added webpack-bundler, webpack-dev-server, html-webpack-plugin and webpack-assets-manifest to scopes/react/react and deleted components/sandbox/webpack-poc - and changes no package version. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Conflict resolutions: - .circleci/config.yml: master's revert of --keep-lane (#10615) applied inside this branch's memory-sampler wrapper for the `bit ci pr` step. - scopes/react/react/react.env.ts, react.main.runtime.ts: stay deleted - this branch removes the core env sources from the workspace, so #10610's edits to them are moot. - scopes/preview/preview/rspack/rspack.config.ts: keep the mdxOptions parameter. The import master re-adds is what this branch removed on purpose: @teambit/mdx.modules.mdx-v3-options is ESM-only and has to reach the config through a native import() done by the caller. - scopes/preview/preview/pre-bundle.ts: keep master's closeRspackCompiler, which logs a close failure instead of swallowing it (#10612), and drop this branch's earlier copy. - workspace.jsonc: both sides - master's webpack-bundler/webpack-dev-server entries plus this branch's exclude-node-modules-js. - pnpm-lock.yaml: regenerated from master's lockfile with `bit install`, so the full-re-resolution lockfile this branch carried is gone. @teambit/react is now the only added package (1.0.1099, consumed from the registry); everything else is importers and duplicate versions dropping out with the core env sources. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…s elsewhere (#10620) ## Summary `react.env`, `react.main.runtime`, and the app-build files only ever needed `WebpackConfigTransformer` / `WebpackConfigMutator` / `Configuration` **types** from `@teambit/webpack` (the old core-aspect package). Same for `aspect.env`. Those type-only imports still made bit's dependency resolver add `@teambit/webpack` as a real runtime dependency of the published `@teambit/react`/`@teambit/aspect` packages. `@teambit/webpack` carries its own exact-pinned `[email protected]` + `webpack-assets-manifest`, separate from the `webpack-bundler`/`webpack-dev-server` packages react/aspect actually bundle with (PR #10610). pnpm resolves these as two different webpack module instances, so the `WebpackAssetsManifest` plugin (built against `@teambit/webpack`'s copy) gets applied to a `Compiler` built by `webpack-bundler`'s copy - causing `The 'compilation' argument must be an instance of Compilation` failures on tag/build for react-based custom envs. ## Fix Source the same types from the packages react/aspect already depend on and actually build with, instead of `@teambit/webpack`: - `WebpackConfigTransformer`, `WebpackConfigDevServerTransformContext` → `@teambit/webpack.webpack-bundler` - `WebpackConfigWithDevServer` → `@teambit/webpack.webpack-dev-server` - `WebpackConfigMutator` → `@teambit/webpack.modules.config-mutator` - `Configuration` → `webpack` directly (matches the existing convention used elsewhere in `scopes/react/react/webpack/*`) No behavior change - type-only imports, just re-pointed. `@teambit/webpack` no longer appears in either package's dependency policy. ## Test plan - [ ] `bit tag --build` on a react-based custom env (the scenario from `e2e/harmony/custom-env-operations.e2e.ts` / `custom-env-operations-2.e2e.ts`) no longer throws the cross-instance webpack error - [ ] `npm view @teambit/react dependencies` / `@teambit/aspect dependencies` no longer lists `@teambit/webpack` after the next release
…#10624) ## Summary react/node/aspect envs build with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server` directly now (#10610), not the `teambit.webpack/webpack` core aspect. Depending on both means pnpm resolves two independently-versioned webpack instances - the exact root cause behind the `instanceof Compilation` failures fixed in #10620. This PR only adds `@deprecated` JSDoc to the now-superseded surface (`WebpackMain.createBundler`/`createDevServer`/`mergeConfig`, the `WebpackBundler`/`WebpackDevServer` classes, and the various type/utility re-exports) so anyone still importing from `@teambit/webpack` gets a signal to move to the standalone packages. No code is removed and no behavior changes - purely additive, safe to merge on its own. A follow-up PR deletes the deprecated code once callers have had a chance to migrate (tracked separately, alongside https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect). ## Test plan - [x] `npm run lint` passes (tsc + oxlint)
Summary
Replaces
this.webpack.createBundler/this.webpack.createDevServerinscopes/react/react/react.env.tswith@teambit/webpack.webpack-bundler'sWebpackBundler.create()and@teambit/webpack.webpack-dev-server'sWebpackDevServer.create(), pinned to1.1.0.ReactEnvno longer depends on theWebpackMainaspect at all -webpack: WebpackMainwas only used for.createBundler/.createDevServer(now removed) and for.pubsub(now sourced by injectingPubsubMaindirectly).WebpackAspectwas dropped fromReactMain'sstatic dependenciesinreact.main.runtime.tsand replaced withPubsubAspect.The public API (
getDevServer,getBundler,createComponentsWebpackBundler,createTemplateWebpackBundler) is unchanged - same signatures, same emitted webpack config.WebpackConfigTransformerwas alreadyimport type.Also cleans up
teambit.webpack/webpack(the core aspect) itself: its internalgenerateAddAliasesFromPeersTransformer,generateExternalsTransformer,resolvePeerToDirOrFile/resolvePeerToFile, andWebpackBitReporterPluginimplementations are now thin re-exports of the new standalone@teambit/webpack.transformers.generate-add-aliases-from-peers,@teambit/webpack.transformers.generate-externals,@teambit/webpack.modules.resolve-peer, and@teambit/webpack.plugins.webpack-bit-reporter-pluginpackages (from this change request), instead of maintaining duplicate logic. The now-unused internalget-externals.tswas removed. Public API of@teambit/webpack(import paths/names) is unchanged.Why this needed transformers, and which config is right
@teambit/webpack.webpack-bundler/@teambit/webpack.webpack-dev-server(even at the newly-published1.1.0) build their base webpack config independently ofteambit.webpack/webpack, and their factories have drifted from it. Validated by building a real workspace/component againstteambit.react/react(dogfooded locally, not the published package) and diffing the actual emitted webpack config (viautil.inspect) frombit buildandbit startbefore and after each change. Below is every drift found, what it means in practice, and which side I judged correct (and compensated for via a transformer, unless noted).I also checked the two other consumers of these standalone packages that exist today -
teambit.preview/react-preview(aPreviewimplementation built directly onWebpackBundler/WebpackDevServer) andteambit.react/webpack/react-webpack(its own independent set of webpack config factories, analogous toscopes/react/react/webpack/*) - to see whether they'd already solved some of this drift, and added a column for them below.Bundler config
react-preview+react-webpackwebpack-assets-manifestpluginasset-manifest.json, mapping entry names to their emitted (hashed) filenames. Consumers that need to reference a built bundle by name at runtime - e.g.ReactApp's SSR flow injecting the right client bundle into server-rendered HTML - read this file. Without it, that lookup breaks.teambit.react/react. Compensated (addAssetsManifestPlugin, spliced right afterProvidePluginto preserve plugin order).react-webpack's ownwebpack.config.base.prod.tshas aWebpackManifestPluginblock, but it's commented out entirely. So this isn't a package-only regression - it looks like the manifest was deliberately dropped (or never finished) across this whole newer stack, which weakens my "accidental drop" read a little, but I still can't confirm nothing inteambit.react/react's existing consumers depends onasset-manifest.jsontoday, so I kept it for this env specifically rather than drop it to match.Dev-server config
react-preview+react-webpackcomponentPathsRegExps/snapshot.managedPathssnapshot.managedPathsmarks paths as immutable for caching (normally all ofnode_modules). The workspace factory excludes Bit's own component packages from that immutable set, since those get edited locally duringbit start.bit startwould silently stop working for component source changes. Compensated.react-webpack'swebpack.config.component.dev.ts(configComponentDevFactory) setssnapshot.managedPathsdirectly as part of its own component-dev layer, instead of patching the base config afterward. I could have done the same inscopes/react/react/webpack/webpack.config.component.dev.tsinstead of a compensating transformer - equivalent result, arguably a bit tidier since it lives next to the config layer that already ownscomponentPathsRegExps. Left it as a transformer here to keep this PR's diff scoped toreact.env.tsrather than also touching the config-factory files.output.pathinfo: true(package) vs. unset (core aspect)truein development mode when left unset.react-webpackdoesn't set it, same as core aspect (unset). Consistent with "doesn't matter" either way.stats.logging/devServer.client.loggingmissing (package) vs.'error'(core aspect)'error',bit startgets noticeably noisier both server- and client-side - a real DX regression. Compensated.configEnvDevFactorysetsdevServer.client.logging: 'error'(matches core aspect), but for the server-side noise it usesstats: 'minimal'inconfigBaseDevFactoryinstead ofstats.logging: 'error'- a different webpack stats preset that reduces output through a different knob, not a drift so much as a different way of solving the same DX problem. Both also setinfrastructureLogging.level: 'error'.devServer.static[].watch: true(package) vs.false(core aspect)publicoutput dir) watches that directory via Chokidar for changes.publicdirectory typically doesn't exist yet when the dev server starts; Chokidar's behavior on a missing path is to recursively watch up the tree until it finds one that exists - which can end up watching the entire workspace root and burning through macOS's limited FSEvents streams. This was a real, previously-hit perf bug that the core aspect'sfalseexists specifically to avoid. The package reintroduces it. Compensated.react-webpacknorreact-previewoverridesdevServer.static[].watch, so envs built on this stack inherit the package'strueand are potentially exposed to the same FSEvents-exhaustion issue the core aspect's override exists to avoid. This is the one item here I'd actively flag to thereact-preview/react-webpackmaintainers rather than treat as an intentional difference.historyApiFallback.index:'/index.html'(package) vs. an absolute resolved path (core aspect)public/index.htmlfor this component's preview, matching how Bit serves each component's dev preview individually. The package's bare/index.htmlisn't guaranteed to resolve to the right file given Bit's nested workspace/output layout. Compensated.output.pathinfo, this is inherited as-is from@teambit/webpack.webpack-dev-server's own factory.HtmlWebpackPlugingets extrascriptLoading: 'defer'/inject: 'body'(package) vs. unset/default (core aspect)<script>tag is injected and whether it's deferred.deferis generally good practice for not blocking parsing; injecting at the end of<body>is a common companion choice.head+default-script-loading vs.body+defershouldn't be visibly different, and there's no comment or indication in the package that this was a deliberate, tested choice rather than incidental scaffold defaults. Changing default script placement/timing is the kind of thing that should be a deliberate, tested decision (it could interact with how Bit's preview bootstrap script expects the DOM to be ready), not an incidental side effect of switching packages. Compensated (kept existing behavior) rather than adopting the package's choice; worth revisiting deliberately if there's a real reason to prefer it.defer/bodyrather than the core aspect's default.titletoHtmlWebpackPlugin(always "Component preview") vs. core aspect forwardingcontext.titleDevServerContext.titleexists specifically so an env/app can set a custom preview page title.WebpackDevServer.create()simply never passestitlethrough to itsconfigFactorycall - looks like an incompleteness in the package, not an intentional simplification. Compensated.createDevServerTransformersdoesn't touch the HTML title either.process.env.NODE_ENV = 'development'side effect in the package's factory, absent in the core aspect'sprocess.env.NODE_ENVas a side effect of building a config object - not scoped to the returned config at all.bit startprocess, a function silently flipping global process state on every call is a real code smell - it could clobber a different intentional value elsewhere in the same process. Not compensated (harmless in this specific codepath, sinceNODE_ENVis already'development'throughoutbit start), but flagged as something to fix upstream in the package rather than replicate.@teambit/webpack.webpack-dev-serverbase factory both stacks build on).Accepted, not compensated (functionally inert)
assert,punycode,util,url) resolve to slightly different patch versions, sincefallbacksAliases/fallbacksare resolved viarequire.resolve()from within the package's ownnode_modulestree rather than the workspace's. Neither version is "more correct" - they're patch-level, non-behavior-changing polyfill releases; the only difference is which physical copy gets resolved. Forcing exact-version parity would mean re-importing and overridingresolve.alias/resolve.fallbackwholesale from the core aspect, which isn't worth the added coupling for functionally-equivalent shims.WebpackBundler.create()doesn't forwardbundlerContext.metaDatainto theWebpackBundlerconstructor. Purely a log-verbosity/debuggability regression (the core aspect's version is more helpful forbit buildobservability) - not something a transformer can fix, since transformers operate on the webpackConfiguration, not on theBundlerclass's own constructor args. A limitation in the package itself.Should
teambit.react/reactjust usereact-preview/react-webpackinstead?Short answer: not in this PR, and probably not as a wholesale swap at all. A few reasons:
react-webpack's config factories (webpack.config.base.ts,.base.dev.ts,.base.prod.ts,.component.dev.ts,.component.prod.ts,.env.dev.ts) are a parallel, independently-evolving rewrite ofscopes/react/react/webpack/*- different babel-loaderdescriptionDatamatchers, a different refresh-overlay package (@bitdev/react.webpack.refresh-overlayvs. the core env's own./overlay/webpackHotDevClient), different CSS/Sass handling (e.g.quietDeps/silenceDeprecations), anEnvironmentPlugininjection core doesn't have, etc. Adopting it would mean replacingteambit.react/react's entire hand-tuned webpack behavior, not just how it talks to the bundler/dev-server - a much bigger and riskier change than "keep the same config, change how it's produced," which is what was asked here.react-preview/react-webpackfixsnapshot.managedPathsand (partially, viastats: 'minimal') the logging noise, but they don't fixhistoryApiFallback.index, the HTMLtitleforwarding, or - most notably - thedevServer.static[].watchperformance issue. Switching wouldn't getteambit.react/reactto full parity with its current behavior; it would trade one set of gaps for another.react-previewexists), but a bigger architectural call forteambit.react/reactspecifically, given how many other envs/consumers compose with it.Where this comparison was genuinely useful: it independently corroborates that
historyApiFallback.index, the HTMLtitle/scriptLoadinggaps, and the strayNODE_ENVmutation all trace back to@teambit/webpack.webpack-dev-server's own base factory (not something specific to howteambit.react/reactconsumes it), and it surfaced thatreact-preview/react-webpackcurrently carry thestatic.watchperf regression unmitigated - worth raising with whoever maintains that stack, separately from this PR.Core aspect cleanup (
teambit.webpack/webpack)Per the change request, the following now-standalone components already contain byte-for-byte the same logic that used to live inline in the core aspect (only decoupled from Harmony-specific types, e.g.
Logger→ a minimal duck-typed{warn}shape):@teambit/webpack.transformers.generate-add-aliases-from-peers← wastransformers/transformers.ts'sgenerateAddAliasesFromPeersTransformer@teambit/webpack.transformers.generate-externals← wastransformers/transformers.ts'sgenerateExternalsTransformer(+ the now-deletedtransformers/get-externals.ts)@teambit/webpack.modules.resolve-peer← wastransformers/resolve-peer.ts@teambit/webpack.plugins.webpack-bit-reporter-plugin← wasplugins/webpack-bit-reporter-plugin.tsgenerateExposePeersTransformer(already marked[dead code] - no longer used) and itsget-exposed-rules.tshelper were left as-is - no standalone equivalent exists for it in the change request, and removing a still-publicly-exported dead function is a separate, broader API-cleanup decision outside this PR's scope.Validated: temporarily reverted
react.env.ts/react.main.runtime.tsto their pre-refactor state (soWebpackMain.createBundler/createDevServerwere exercised directly again, the same codepath used before any of this PR's changes) and re-ran the same real-workspacebit build/bit startdiff against the very first baseline capture. Both bundler and dev-server configs came back byte-identical aside from expected build timestamps - confirming the delegation is a pure no-op forWebpackMain's own output.ReactApp validation
ReactApp(apps/web/react.application.ts) only callsreactEnv.getDevServer(...)andreactEnv.getBundler(...)- never thecreate*WebpackBundlermethods directly (confirmed via a full repo-wide search). Both are the same methods already validated above for byte-identical config output, and the full workspace type-check (tsc --noEmit) passes, confirmingReactApp's calls (including the extra transformers it layers on:addDevServer,setOutput,setDevServerClient,clientConfig(),ssrConfig(),buildConfig(),replaceTerserPlugin()) still compile against the new signatures. I didn't spin up a full runningReactAppend-to-end, since that requires authoring a whole new custom aspect to register an app instance and no example exists in this workspace to reuse - a disproportionate amount of new scaffolding given the underlying methods are already proven equivalent.Testing
npm run lint(tsc --noEmit && oxlint) passes with 0 errors, on both commits.teambit.react/reactin this workspace (dogfooded) and ranbit build/bit start, diffing the emitted webpack config before/after each change (react env refactor, then core aspect cleanup) against the original baseline.