File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1056,16 +1056,20 @@ class Server {
1056
1056
// TODO remove after drop webpack v4 support
1057
1057
compiler . options . plugins = compiler . options . plugins || [ ] ;
1058
1058
1059
- if (
1060
- this . options . hot &&
1061
- ! compiler . options . plugins . find (
1059
+ if ( this . options . hot ) {
1060
+ const HMRPluginExists = compiler . options . plugins . find (
1062
1061
( p ) => p . constructor === webpack . HotModuleReplacementPlugin
1063
- )
1064
- ) {
1065
- // apply the HMR plugin, if it didn't exist before.
1066
- const plugin = new webpack . HotModuleReplacementPlugin ( ) ;
1062
+ ) ;
1067
1063
1068
- plugin . apply ( compiler ) ;
1064
+ if ( HMRPluginExists ) {
1065
+ this . logger . warn (
1066
+ `"hot: true" automatically applies HMR plugin, you don't have to add it manually to your webpack configuration.`
1067
+ ) ;
1068
+ } else {
1069
+ // apply the HMR plugin
1070
+ const plugin = new webpack . HotModuleReplacementPlugin ( ) ;
1071
+ plugin . apply ( compiler ) ;
1072
+ }
1069
1073
}
1070
1074
} ) ;
1071
1075
You can’t perform that action at this time.
0 commit comments