diff --git a/.changeset/breezy-rice-behave.md b/.changeset/breezy-rice-behave.md new file mode 100644 index 000000000..f053dc849 --- /dev/null +++ b/.changeset/breezy-rice-behave.md @@ -0,0 +1,5 @@ +--- +"webpack-dev-middleware": patch +--- + +Fixed compatibility with rspack. diff --git a/src/index.js b/src/index.js index ea71d4d54..9767001a8 100644 --- a/src/index.js +++ b/src/index.js @@ -318,6 +318,8 @@ function printStats(stats, context) { (compiler).compilers; childStatsOptions.colors = + // rspack compatibility + firstCompiler.webpack.cli && typeof firstCompiler.webpack.cli.isColorSupported === "function" ? firstCompiler.webpack.cli.isColorSupported() : isColorSupported(); @@ -334,6 +336,8 @@ function printStats(stats, context) { if (typeof statsOptions.colors === "undefined") { const { compiler } = /** @type {{ compiler: Compiler }} */ (context); statsOptions.colors = + // rspack compatibility + compiler.webpack.cli && typeof compiler.webpack.cli.isColorSupported === "function" ? compiler.webpack.cli.isColorSupported() : isColorSupported();