webpack-contrib / webpack-hot-middleware

Webpack hot reloading you can attach to your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NoEmitOnErrorsPlugin seems to have no effect

joaquimds opened this issue · comments

  • Operating System: Windows / OSX
  • Node Version: 12.16.1
  • NPM Version: 6.13.4
  • webpack Version: 4.42.0
  • webpack-dev-middleware Version: 3.7.2
  • webpack-hot-middleware Version: 2.25.0

Expected Behavior

NoEmitOnErrorsPlugin prevents the error screen showing on the front-end, when there are compilation errors.

Actual Behavior

The error messages seem to be the same whether or not the plugin is included.

Code

  // webpack.config.js
  entry.push('webpack-hot-middleware/client?reload=true')
  plugins.push(new wp.HotModuleReplacementPlugin())
  plugins.push(new wp.NoEmitOnErrorsPlugin())
  resolve.alias['react-dom'] = '@hot-loader/react-dom'

How Do We Reproduce?

Simply create an App.js that compiles, then introduce compilation errors, e.g.

import React

export const App = () => {
  }
  return <h1>Test</h1>
}

The NoEmitOnErrors plugin only stops a broken bundle being emitted to disk

👍