refactor(commands): unify webpack and Rspack commands - #1424
Conversation
… and --bundler option Add Bundler type alias, CompilerInterface and CompilerAsset to the shared types.ts. Remove duplicate CompilerAsset definitions from rspack/types.ts and webpack/types.ts. Add --bundler <string> CLI option to both startCommandOptions and bundleCommandOptions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add detectBundler() utility that determines the bundler engine with the following priority: 1. Explicit --bundler flag 2. Custom config path filename inference (rspack.* vs webpack.*) 3. Config file discovery (rspack configs checked first) 4. Default: rspack Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Webpack Compiler: - Remove EventEmitter inheritance - Add platforms property and devServerContext with late-init - Add setDevServerContext() and start() (no-op) methods - Internalize event handling: worker messages now call devServerContext.notifyBuildStart/End and broadcastToHmrClients directly instead of emitting events - Constructor now takes platforms as first argument Rspack Compiler: - Add 'implements CompilerInterface' declaration - Import CompilerAsset from shared types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ction Add unified bundle.ts and start.ts that merge the rspack and webpack implementations, using detectBundler() and dynamic imports to select the correct engine at runtime. Add commands/index.ts exporting the unified command definitions and a createBoundCommands() helper for deprecated entry points. Add commands/index.js and commands/index.d.ts as the new primary CJS entry point. Update commands/rspack.js and commands/webpack.js to be deprecation wrappers that delegate via createBoundCommands(). Add './commands' export to package.json (alongside existing wildcard). Delete old bundler-specific files: - rspack/bundle.ts, rspack/start.ts, rspack/index.ts - webpack/bundle.ts, webpack/start.ts, webpack/index.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update init package: - Remove bundler parameter from modifyReactNativeConfig() - Use '@callstack/repack/commands' instead of bundler-specific paths Simplify react-native.config.js in all test apps to use the unified import instead of conditional require based on USE_WEBPACK env var. Update integration tests to import from '@callstack/repack/commands' instead of separate rspack/webpack command sets. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@jbroma is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 06daa86 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
he's back! |
|
@jbroma I think there might be some small thing to check with the tester apps using USE_WEBPACK for example in |
There was a problem hiding this comment.
if a user has the webpack commands and specifies --bundler=rspack what happens? Should we care to handle it? In this case it would be overruled by the createBoundCommands function right?
Summary
@callstack/repack/commandsentry point with automatic bundler detection and a validated--bundleroverridestartandbundlecommand orchestration and dev-server delegate while preserving the separate Rspack and webpack compiler implementationsWhy
The command registries and most command orchestration were duplicated even though both bundlers already shared the config and dev-server layers. This gives users one stable command entry point while keeping each bundler's deliberately different execution model behind a small shared compiler interface.
Related to #1421. This PR intentionally does not merge compiler internals,
defineConfighelpers, or bundler configuration templates: those remain bundler-specific where their types and runtime behavior differ.Validation
@callstack/repack: 31 Jest suites, 290 tests, and 22 snapshots passedtester-app,tester-federation, andtester-federation-v2, including async chunks, miniapp lifecycle, and both Module Federation gallery flows