Skip to content

docs(webpack): deprecate the core aspect's bundler/dev-server surface - #10624

Merged
GiladShoham merged 1 commit into
masterfrom
deprecate/webpack-core-aspect-bundler
Aug 16, 2026
Merged

GiladShoham merged 1 commit into
masterfrom
deprecate/webpack-core-aspect-bundler

Conversation

@GiladShoham

Copy link
Copy Markdown
Member

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

  • npm run lint passes (tsc + oxlint)

react/node/aspect envs now build with @teambit/webpack.webpack-bundler and
@teambit/webpack.webpack-dev-server directly (#10610), not this aspect - see
https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect.

Marks WebpackMain.createBundler/createDevServer/mergeConfig, the
WebpackBundler/WebpackDevServer classes, and the rest of the public exports
as @deprecated so anyone still importing from @teambit/webpack gets a signal
to move to the standalone packages instead. No behavior change - a follow-up
will delete the deprecated code once callers have migrated.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Deprecate @teambit/webpack bundler/dev-server surface in favor of standalone packages

📝 Documentation ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Add @deprecated JSDoc across @teambit/webpack bundler/dev-server exports to signal migration.
• Document the root issue: avoid multiple independently-resolved webpack instances in pnpm.
• Refresh pnpm lockfile to align with updated webpack-related Bit packages and transitive deps.
Diagram

graph TD
  C(["Consumers (envs/apps)"]) --> A["@teambit/webpack (core aspect)"] --> B["@teambit/webpack.webpack-bundler"] --> W{{"webpack (dep)"}}
  A --> D["@teambit/webpack.webpack-dev-server"] --> W
  C --> B
  C --> D
  A --> T["@teambit/webpack.transformers.*"]
  A --> M["@teambit/webpack.modules.config-mutator"]

  subgraph Legend
    direction LR
    _c(["Consumer"]) ~~~ _p["Package"] ~~~ _e{{"External dep"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Make @teambit/webpack a thin proxy that re-exports standalone packages
  • ➕ Keeps existing import paths working without duplicated implementations
  • ➕ Centralizes migration guidance while still converging on one webpack instance
  • ➖ Still preserves the legacy entrypoint surface area longer
  • ➖ Requires careful dependency/peerDependency setup to truly avoid duplicate webpack resolution
2. Add runtime warnings (in addition to JSDoc) when deprecated APIs are invoked
  • ➕ Catches non-TypeScript consumers and CI logs show actionable migration hints
  • ➕ Makes deprecated usage visible even when editors ignore JSDoc
  • ➖ Not purely additive from a behavior standpoint (new console output)
  • ➖ Can be noisy for large workspaces until migration completes
3. Ship a codemod / lint rule to auto-migrate imports
  • ➕ Reduces migration friction and speeds adoption
  • ➕ Enforces avoiding the dual-webpack-instance pitfall systematically
  • ➖ Extra maintenance/tooling cost
  • ➖ May not cover all edge cases (custom wrappers, deep imports)

Recommendation: The PR’s current approach (JSDoc @deprecated across the legacy surface) is the best immediate step: it is additive, low-risk, and directly addresses the duplicated-webpack-instance problem by steering imports to the standalone packages. Consider layering a follow-up with either a proxy-style re-export (to reduce long-tail breakage) or a codemod/lint rule to accelerate migration before the planned deletion PR.

Files changed (15) +275 / -123

Documentation (14) +101 / -0
webpack-fallbacks-aliases.tsDeprecate legacy fallbacksAliases re-export +4/-0

Deprecate legacy fallbacksAliases re-export

• Adds '@deprecated' JSDoc explaining that the standalone bundler ships its own copy and no longer reads this module from the aspect. Retains export for backward-compatible 'from '@teambit/webpack'' imports.

scopes/webpack/webpack/config/webpack-fallbacks-aliases.ts

webpack-fallbacks-provide-plugin-config.tsDeprecate legacy ProvidePlugin fallbacks config re-export +4/-0

Deprecate legacy ProvidePlugin fallbacks config re-export

• Annotates the exported config object as deprecated and points consumers to the standalone bundler’s copy. Keeps the export solely for backward compatibility.

scopes/webpack/webpack/config/webpack-fallbacks-provide-plugin-config.ts

webpack-fallbacks.tsDeprecate legacy fallbacks map re-export +4/-0

Deprecate legacy fallbacks map re-export

• Adds '@deprecated' JSDoc to the exported 'fallbacks' object clarifying it is no longer read by the standalone bundler. Export remains for compatibility with existing imports from '@teambit/webpack'.

scopes/webpack/webpack/config/webpack-fallbacks.ts

webpack-compilation-done-event.tsMark compilation-done event as deprecated legacy export +4/-0

Mark compilation-done event as deprecated legacy export

• Adds a deprecation notice indicating the event is not published/used by the current bundler/dev-server replacements. Kept only to avoid breaking existing imports.

scopes/webpack/webpack/events/webpack-compilation-done-event.ts

webpack-compilation-started-event.tsMark compilation-started event as deprecated legacy export +4/-0

Mark compilation-started event as deprecated legacy export

• Adds '@deprecated' JSDoc clarifying the event is no longer part of the supported surface and is retained only for backward-compatible imports.

scopes/webpack/webpack/events/webpack-compilation-started-event.ts

index.tsDeprecate the @teambit/webpack public entrypoint and key re-exports +14/-0

Deprecate the @teambit/webpack public entrypoint and key re-exports

• Adds a top-level deprecation banner explaining previews/apps no longer build through this aspect and directs consumers to standalone packages. Marks specific re-exports (e.g., webpack 'Configuration', 'WebpackConfigMutator') with deprecation guidance to import from their source packages directly.

scopes/webpack/webpack/index.ts

webpack-bit-reporter-plugin.tsDeprecate thin re-export of WebpackBitReporterPlugin +4/-0

Deprecate thin re-export of WebpackBitReporterPlugin

• Adds a deprecation header clarifying this file is only a compatibility re-export. Directs consumers to import from '@teambit/webpack.plugins.webpack-bit-reporter-plugin' instead.

scopes/webpack/webpack/plugins/webpack-bit-reporter-plugin.ts

run-transformer.tsDeprecate legacy transformer runner in favor of standalone bundler equivalent +4/-0

Deprecate legacy transformer runner in favor of standalone bundler equivalent

• Adds '@deprecated' JSDoc noting the function is equivalent to the standalone bundler’s transformer runner and is kept only for legacy imports.

scopes/webpack/webpack/run-transformer.ts

inject-body.tsDeprecate GenerateBodyInjectionTransformer due to config ownership shift +3/-0

Deprecate GenerateBodyInjectionTransformer due to config ownership shift

• Adds deprecation notes explaining the webpack aspect no longer guarantees sharing the same html-webpack-plugin instance as the bundler that actually builds configs. Retains export for backward compatibility.

scopes/webpack/webpack/transformers/inject-body.ts

inject-head.tsDeprecate GenerateHeadInjectionTransformer due to config ownership shift +3/-0

Deprecate GenerateHeadInjectionTransformer due to config ownership shift

• Adds '@deprecated' JSDoc mirroring inject-body: the aspect is no longer responsible for the base config in the relevant envs, so shared plugin-instance assumptions no longer hold.

scopes/webpack/webpack/transformers/inject-head.ts

transformers.tsDeprecate transformer re-exports and flag unused helper for removal +6/-0

Deprecate transformer re-exports and flag unused helper for removal

• Adds deprecation notes to the thin re-exports, pointing to the standalone transformer packages. Also marks the internally-dead 'generateExposePeersTransformer' as deprecated and slated for removal.

scopes/webpack/webpack/transformers/transformers.ts

webpack.bundler.tsDeprecate aspect-scoped WebpackBundler implementation +6/-0

Deprecate aspect-scoped WebpackBundler implementation

• Annotates the class as deprecated, explaining it is duplicated by '@teambit/webpack.webpack-bundler' and that using both can pull in multiple webpack instances. Keeps implementation intact for compatibility.

scopes/webpack/webpack/webpack.bundler.ts

webpack.dev-server.tsDeprecate aspect-scoped WebpackDevServer implementation +6/-0

Deprecate aspect-scoped WebpackDevServer implementation

• Adds deprecation guidance pointing to '@teambit/webpack.webpack-dev-server' as the supported implementation. Notes the duplicated-webpack-instance risk when depending on both.

scopes/webpack/webpack/webpack.dev-server.ts

webpack.main.runtime.tsDeprecate WebpackMain APIs and related types to steer imports to standalone packages +35/-0

Deprecate WebpackMain APIs and related types to steer imports to standalone packages

• Adds deprecation documentation for the core context/transformer types and for 'WebpackMain' itself. Specifically marks 'createDevServer', 'createBundler', and 'mergeConfig' with guidance on preferred replacements (standalone packages or direct 'webpack-merge').

scopes/webpack/webpack/webpack.main.runtime.ts

Other (1) +174 / -123
pnpm-lock.yamlUpdate lockfile for newer Bit webpack-related packages and transitive deps +174/-123

Update lockfile for newer Bit webpack-related packages and transitive deps

• Bumps versions of several @teambit packages (notably preview/react-webpack and webpack bundler/dev-server) and reshuffles some dependency placements. Also updates transitive dependencies (e.g., schema-utils and ws) as part of the lockfile refresh.

pnpm-lock.yaml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. React 18 variant added 🐞 Bug ☼ Reliability
Description
pnpm-lock.yaml now resolves @teambit/[email protected] in a React 18.3.1 context
(react/react-dom), adding a second React major to the install graph. This conflicts with the
workspace override strategy that tries to keep a single React version and risks duplicate React
instances / type incompatibilities in preview/env loading.
Code

pnpm-lock.yaml[R90212-90215]

Evidence
The lockfile snapshot explicitly installs React 18.3.1 for the updated preview package, while the
workspace overrides only pin React 19 and collapse React 17—there is no override for React 18, so it
remains a separate resolution path.

pnpm-lock.yaml[90203-90215]
workspace.jsonc[695-724]
workspace.jsonc[747-757]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The lockfile introduces a React 18.3.1 resolution path (via `@teambit/[email protected]`) alongside the workspace’s intended React 19 unification. This can lead to multiple React majors installed and resolved into different peer-variants.

## Issue Context
The workspace config explicitly pins React 19 and collapses older React 17 contexts to avoid duplicated React installs/types, but it does not pin React 18. The new lock snapshot for `@teambit/[email protected]` includes `react: 18.3.1` / `react-dom: 18.3.1`.

## Fix Focus Areas
- pnpm-lock.yaml[901-980]
- pnpm-lock.yaml[90191-90220]
- workspace.jsonc[695-724]

### Suggested remediation options
1) If this PR is intended to be deprecation-docs only: revert/regenerate `pnpm-lock.yaml` to the previous resolution (e.g. keep `@teambit/preview.react-preview` at `1.1.13`, which does not introduce the React 18 context shown in this PR diff).
2) If `@teambit/[email protected]` is required: add explicit overrides for `react@18` and `react-dom@18` to align with the workspace React policy, and verify previews still work end-to-end.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Lockfile churn in docs PR 🐞 Bug ⚙ Maintainability
Description
pnpm-lock.yaml updates resolve multiple @teambit packages to newer minor versions (e.g.
@teambit/preview.react-preview 1.2.0 and @teambit/react.webpack.react-webpack 1.0.60), coupling
dependency upgrades with the deprecation-only code changes. This makes the change harder to review
and any regressions harder to attribute/roll back.
Code

pnpm-lock.yaml[R916-918]

Evidence
The lockfile importers section shows the resolved versions advancing within caret ranges for key
packages, demonstrating this PR changes the dependency graph beyond adding JSDoc deprecations.

pnpm-lock.yaml[916-918]
pnpm-lock.yaml[943-945]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR includes resolved-version upgrades in `pnpm-lock.yaml` in addition to the intended `@deprecated` annotations.

## Issue Context
Even minor upgrades can change behavior; mixing them into a deprecation-only PR increases review surface and makes bisecting regressions harder.

## Fix Focus Areas
- pnpm-lock.yaml[915-946]

### Suggested remediation
- If the intent is deprecation annotations only: restore `pnpm-lock.yaml` to the previous state (or regenerate it without upgrading resolutions).
- Otherwise: split the lockfile upgrades into a dedicated PR with an explicit changelog/test plan for the upgraded packages.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread pnpm-lock.yaml
Comment on lines +90212 to +90215
react: 18.3.1
react-dom: 18.3.1(react@18.3.1)
webpack: 5.97.1([email protected])([email protected])
webpack-dev-server: 4.15.0([email protected])([email protected])([email protected])([email protected])
webpack-dev-server: 4.15.0([email protected])([email protected])([email protected])([email protected])([email protected])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. React 18 variant added 🐞 Bug ☼ Reliability

pnpm-lock.yaml now resolves @teambit/[email protected] in a React 18.3.1 context
(react/react-dom), adding a second React major to the install graph. This conflicts with the
workspace override strategy that tries to keep a single React version and risks duplicate React
instances / type incompatibilities in preview/env loading.
Agent Prompt
## Issue description
The lockfile introduces a React 18.3.1 resolution path (via `@teambit/[email protected]`) alongside the workspace’s intended React 19 unification. This can lead to multiple React majors installed and resolved into different peer-variants.

## Issue Context
The workspace config explicitly pins React 19 and collapses older React 17 contexts to avoid duplicated React installs/types, but it does not pin React 18. The new lock snapshot for `@teambit/[email protected]` includes `react: 18.3.1` / `react-dom: 18.3.1`.

## Fix Focus Areas
- pnpm-lock.yaml[901-980]
- pnpm-lock.yaml[90191-90220]
- workspace.jsonc[695-724]

### Suggested remediation options
1) If this PR is intended to be deprecation-docs only: revert/regenerate `pnpm-lock.yaml` to the previous resolution (e.g. keep `@teambit/preview.react-preview` at `1.1.13`, which does not introduce the React 18 context shown in this PR diff).
2) If `@teambit/[email protected]` is required: add explicit overrides for `react@18` and `react-dom@18` to align with the workspace React policy, and verify previews still work end-to-end.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment thread pnpm-lock.yaml
Comment on lines 916 to +918

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Lockfile churn in docs pr 🐞 Bug ⚙ Maintainability

pnpm-lock.yaml updates resolve multiple @teambit packages to newer minor versions (e.g.
@teambit/preview.react-preview 1.2.0 and @teambit/react.webpack.react-webpack 1.0.60), coupling
dependency upgrades with the deprecation-only code changes. This makes the change harder to review
and any regressions harder to attribute/roll back.
Agent Prompt
## Issue description
The PR includes resolved-version upgrades in `pnpm-lock.yaml` in addition to the intended `@deprecated` annotations.

## Issue Context
Even minor upgrades can change behavior; mixing them into a deprecation-only PR increases review surface and makes bisecting regressions harder.

## Fix Focus Areas
- pnpm-lock.yaml[915-946]

### Suggested remediation
- If the intent is deprecation annotations only: restore `pnpm-lock.yaml` to the previous state (or regenerate it without upgrading resolutions).
- Otherwise: split the lockfile upgrades into a dedicated PR with an explicit changelog/test plan for the upgraded packages.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@GiladShoham
GiladShoham enabled auto-merge (squash) August 16, 2026 10:44
@github-actions github-actions Bot mentioned this pull request Aug 16, 2026
@GiladShoham
GiladShoham merged commit fb3e2eb into master Aug 16, 2026
17 checks passed
@GiladShoham
GiladShoham deleted the deprecate/webpack-core-aspect-bundler branch August 16, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants