stephencookdev / speed-measure-webpack-plugin

⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds
MIT License
2.41k stars 80 forks source link

Using SpeedMeasurePlugin with HMR seems to somehow break the HotModuleReplacementPlugin #158

Open scottdickerson opened 3 years ago

scottdickerson commented 3 years ago

Here was my configuration:

const devPlugins = [
  new webpack.HotModuleReplacementPlugin(),
  new ReactRefreshWebpackPlugin({
    overlay: {
      sockIntegration: 'whm',
    },
  }),
new SpeedMeasurePlugin();
module.exports = smp.wrap({
entry: {
    main: isDev ? ['webpack-hot-middleware/client', './src/index.jsx'] : ['./src/index.jsx'],
  },
...

Inside my browser I get an error from the webpack-hot-middleware/client saying Hot Module Loading has been disabled because it can't find module.hot on the javascript files. If I set disable to true for the SpeedMeasurePlugin, the Hot Module Loading starts working again

Here's the browser error

process-update.js?881f:10 Uncaught Error: [HMR] Hot Module Replacement is disabled.
    at eval (process-update.js?881f:10)
    at Object.82100 (vendor.webpack-hot-middleware.js:59)
    at __webpack_require__ (main.js:2655)
    at eval (client.js?0e05:233)
    at Object.93950 (vendor.webpack-hot-middleware.js:27)
    at __webpack_require__ (main.js:2655)
    at checkDeferredModulesImpl (main.js:2969)
    at Function.__webpack_require__.x (main.js:2982)
    at main.js:2988
    at main.js:2989
scottdickerson commented 3 years ago

ok I wasa able to reproduce

kingback commented 3 years ago

me too, seems like the compilation.compiler is proxyed

compilation.compiler !== compiler

image

tstordyallison commented 1 year ago

Seconded - I found this issue after having to get the debugger out on webpack... once I saw the proxy was in SMP, it all fell into place.

Doh.