Skip to content

Plugin apply not working for multi compiler #18236

Closed
@nuintun

Description

@nuintun

Bug report

What is the current behavior?

Plugin apply not working for multi compiler.

If the current behavior is a bug, please provide the steps to reproduce.

import webpack from 'webpack';

const compiler = webpack([{
  // ...
}]);

for(const compiler of compiler.compilers) {
  // DefinePlugin
  new webpack.DefinePlugin(
    // ...
  ).apply(compiler);

  // EntryPlugin
  new webpack.EntryPlugin(
    // ...
  ).apply(compiler);

  // HotModuleReplacementPlugin
  new webpack.HotModuleReplacementPlugin(
    // ...
  ).apply(compiler);
}

All plugins DefinePlugin, EntryPlugin, HotModuleReplacementPlugin are not working.

Also see: https://github.com/webpack/webpack-dev-server/blob/edbc6e14cd96c6d652f8fef2d5fcfe6af829231a/lib/Server.js#L1639

What is the expected behavior?

Plugin apply not working for multi compiler.

Other relevant information:
webpack version: 5.91.0
Node.js version: 21.7.1
Operating System: Windows 11
Additional tools: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions