migração

Migrar de webpack para Rspack

Licença e termos

webpack
MIT, Código aberto
Rspack
MIT, Código aberto
Tipo de substituição
Drop-in Accepts webpack configuration and most of its loaders and plugins.

Esta página está escrita em inglês.

Compatibility

Rspack’s API and configuration align with webpack 5, and it supports most webpack configuration options, most built-in plugins (same names and parameters) and most loaders. The guide is written for webpack 5 projects: on webpack 4 or earlier, read webpack’s own v4 to v5 guide for the differences, and Create React App or Vue CLI projects have their own guides.

Before you switch

  1. Check Node.js on every build machine, CI included. @rspack/core@2 requires Node.js ^20.19.0 || >=22.12.0.
  2. Install @rspack/core, plus @rspack/cli and @rspack/dev-server if you used webpack-cli and webpack-dev-server. Keep @rspack/core and @rspack/cli on the same version.
  3. Point your scripts at rspack dev, rspack build and rspack preview, and rename webpack.config.js to rspack.config.js, the file Rspack loads when none is given.
  4. Take built-in plugins from @rspack/core instead of webpack (new webpack.DefinePlugin becomes new rspack.DefinePlugin), and replace ecosystem packages: webpack-dev-middleware becomes @rspack/dev-middleware, webpack-chain becomes rspack-chain, webpack-merge becomes rspack-merge.
  5. Once the build works, remove webpack, webpack-cli and webpack-dev-server, unless a loader, plugin or script still imports webpack or webpack/lib/*.

Pitfalls

Guia oficial

Guia de migração de Rspack ↗

Revisado em 2026-09-29.

Fontes

Outras alternativas a webpack →