Class: RepackPlugin
Webpack plugin, which abstracts configuration of other Re.Pack's plugin to make Webpack config more readable.
example
Usage in Webpack config (ESM):
import * as Repack from '@callstack/repack';
export default (env) => {
const {
mode = 'development',
platform,
devServer = undefined,
} = env;
return {
plugins: [
new Repack.RepackPlugin({
mode,
platform,
devServer,
}),
],
};
};
Internally, RepackPlugin
configures the following plugins:
webpack.DefinePlugin
with__DEV__
global- AssetsResolverPlugin
- OutputPlugin
- DevelopmentPlugin
- RepackTargetPlugin
webpack.SourceMapDevToolPlugin
- LoggerPlugin
RepackPlugin
provides a sensible defaults, but can be customized to some extent.
If you need more control, it's recommended to remove RepackPlugin
and use other plugins
directly, eg:
import * as Repack from '@callstack/repack';
new Repack.plugins.AssetsResolverPlugin();
Implements
Table of contents
Constructors
Methods
Constructors
constructor
• new RepackPlugin(config
)
Constructs new RepackPlugin
.
Parameters
Name | Type | Description |
---|---|---|
config | RepackPluginConfig | Plugin configuration options. |
Defined in
packages/repack/src/webpack/plugins/RepackPlugin.ts:116
Methods
apply
▸ apply(compiler
): void
Apply the plugin.
Parameters
Name | Type | Description |
---|---|---|
compiler | Compiler | Webpack compiler instance. |
Returns
void