LoaderOptionsPlugin

The LoaderOptionsPlugin is unlike other plugins in that it is built for migration from webpack 1 to 2. In webpack 2, the schema for a webpack.config.js became stricter; no longer open for extension by other loaders and plugins. The intention is that you pass options directly to loaders and plugins (i.e. options are not global or shared).

However, until a loader has been updated to depend upon options being passed directly to them, the LoaderOptionsPlugin exists to bridge the gap. You can configure global loader options with this plugin and all loaders will receive these options.

new webpack.LoaderOptionsPlugin({
  // Options...
})
This plugin will be removed in the future as it only exists for migration.

Options

This plugin supports the following options:

Usage

Here's an example of how this plugin might be used:

new webpack.LoaderOptionsPlugin({
  minimize: true,
  debug: false,
  options: {
    context: __dirname
  }
})