You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible that third-party Webpack plugins published on npm do not work with Rspack.
Usually, the Rspack team tries to provide built-in plugins for most popular Webpack plugins, and you'll need to integrate them with if/else conditions using currentBundler.name = "webpack" | "rspack".
As far as I have seen, none of the popular plugins in the Docusaurus community are in this situation. Please let me know what Webpack plugin you are trying to use and we'll figure out a solution.
Examples
Here are a few examples of community plugin PRs to add support:
Docusaurus Faster - For plugins authors
Docusaurus Faster sister issue for plugin authors implementing the
configureWebpack()
lifecycle hook.How to migrate your code
The general idea is that you shouldn't import Weppack directly, because... It will always be Webpack.
You should avoid this kind of code:
What you should do instead is use a dynamic value that will be either Webpack or Rspack:
currentBundler.instance
that we inject inconfigureWebpack
compiler.webpack
(see example)If your plugin doesn't import Webpack directly and only tweaks a bit the config as data, it will probably work out of the box.
Example diff of a typical plugin that needs to be updated
Example diff of a Webpack plugin coming from node-polyfill-webpack-plugin v3:
Retrocompatibility
For plugins published on npm, the
currentBundler
is only injected starting Docusaurus v3.6.If you still want to keep retro compatibility with older v3 versions, you can write defensive code like this:
Using third-party Webpack plugins
It is possible that third-party Webpack plugins published on npm do not work with Rspack.
Usually, the Rspack team tries to provide built-in plugins for most popular Webpack plugins, and you'll need to integrate them with if/else conditions using
currentBundler.name = "webpack" | "rspack"
.Here's how we do this: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-bundler/src/currentBundler.ts
As far as I have seen, none of the popular plugins in the Docusaurus community are in this situation. Please let me know what Webpack plugin you are trying to use and we'll figure out a solution.
Examples
Here are a few examples of community plugin PRs to add support:
Good luck!
The text was updated successfully, but these errors were encountered: