The content of this section is derived from the content of the following links and is subject to the CC BY 4.0 license.
The following contents can be assumed to be the result of modifications and deletions based on the original contents if not specifically stated.
This is a list of plugins used internally by Rspack, aligned with the plugins used internally by webpack.
You should only concern yourself with these plugins if you are building your own compiler based on Rspack, or for internal inspection.
Categories of internal plugins:
Plugins affecting the environment of the compiler.
electron.ElectronTargetPlugin(context)
Customizes the handling of external dependencies for different contexts (such as main process, preload scripts, and renderer process) in Electron applications.
externalsPresets.electron
, externalsPresets.electronMain
, externalsPresets.electronRenderer
, and externalsPresets.electronPreload
all rely on this plugin.
node.NodeEnvironmentPlugin()
Applies Node.js style filesystem to the compiler.
Plugins affecting the compiler.
ProgressPlugin(handler)
Hook into the compiler to extract progress information. The handler
must have the signature function(percentage, message)
. Percentage is called with a value between 0 and 1, where 0 indicates the start and 1 the end.
Plugins, which add entry chunks to the compilation.
EntryPlugin(context, entry, options)
Adds an entry chunk on compilation. The chunk is named options.name
and contains only one module (plus dependencies). The module is resolved from entry
in context
(absolute path).
context
: The base path for module resolution, under which the entry module resolution will be conducted.entry
: Specifies the module path to be used as an entry point.options
: Additional configurations for the entry module.DynamicEntryPlugin(context, entry)
Similar to EntryPlugin
but accepts a function as the entry
argument. This function is called during each make
event in the build process to support dynamically determining the entry points.
EntryOptionPlugin()
EvalDevToolModulePlugin(options)
Decorates the module template by wrapping each module in a eval
annotated with // @sourceURL
.
webworker.WebWorkerTemplatePlugin(options)
Chunks are loaded by importScripts
.
options
are the output options.
This plugin is used to provide runtime code for WASM bundling and is often used together with a child compiler.
web.FetchCompileAsyncWasmPlugin()
Plugins affecting the source code of modules.
ProvidePlugin(name, request)
If name
is used in a module it is filled by a module loaded by require(<request>)
.
node.NodeTargetPlugin()
The plugins should be used if you run the bundle in a Node.js environment.
If ensures that native modules are loaded correctly even if bundled.
Note that all plugins under rspack.optimize
namespace should only be used when mode
set to 'none'
. Otherwise you might get into trouble where plugins are applied twice.
optimize.LimitChunkCountPlugin(options)
Merge chunks limit chunk count is lower than options.maxChunks
.
The overhead for each chunks is provided by options.chunkOverhead
or defaults to 10000. Entry chunks sizes are multiplied by options.entryChunkMultiplicator
(or 10).
Chunks that reduce the total size the most are merged first. If multiple combinations are equal the minimal merged size wins.
LoaderOptionsPlugin(options)
LoaderTargetPlugin(target)
Internal plugins used with Module Federation, which are the basis of the ModuleFederationPlugin
.
container.ContainerPlugin(options)
container.ContainerReferencePlugin(options)
sharing.ConsumeSharedPlugin(options)
sharing.ProvideSharedPlugin(options)
sharing.SharePlugin(options)