'React fast refresh not working with wp-scripts

I am trying to create a simple gutenberg plugin for wordpress. I installed the wp-scripts and created, as the instructions, a script with

"start:hot": "wp-scripts start --hot"

But when I start I get this error:
$ wp-scripts start --hot
[webpack-cli] webpack Dev Server Invalid Options

options should NOT have additional properties
options.allowedHosts should be {Array} (https://webpack.js.org/configuration/dev-server/#devserverallowedhosts)

I run wordpress locally with wp/env but I don't think it is this the problem, and I am following the official instructions from the wp-scripts website. It works fine with wp-scripts start but not with --hot flag. Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source