Skip to content

Commit

Permalink
Fix issue gregberge#83
Browse files Browse the repository at this point in the history
  • Loading branch information
milosivanovic committed Oct 2, 2021
1 parent fe2cd08 commit d795c82
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class ErrorOverlayPlugin {
const devServerEnabled = !!compiler.options.devServer
const sockOptions = {}
if (devServerEnabled) {
sockOptions.sockHost = compiler.options.devServer.sockHost
sockOptions.sockPath = compiler.options.devServer.sockPath
sockOptions.sockPort = compiler.options.devServer.sockPort
sockOptions.sockHost = compiler.options.devServer.client.webSocketURL.hostname
sockOptions.sockPath = compiler.options.devServer.client.webSocketURL.pathname
sockOptions.sockPort = compiler.options.devServer.client.webSocketURL.port
}

compiler.hooks.entryOption.tap(className, (context, entry) => {
Expand All @@ -23,12 +23,12 @@ class ErrorOverlayPlugin {

compiler.hooks.afterResolvers.tap(className, ({ options }) => {
if (devServerEnabled) {
const originalBefore = options.devServer.before
options.devServer.before = (app, server) => {
const originalBefore = options.devServer.onBeforeSetupMiddleware
options.devServer.onBeforeSetupMiddleware = (devServer) => {
if (originalBefore) {
originalBefore(app, server, compiler)
originalBefore(devServer.app, devServer.server, devServer.compiler)
}
app.use(errorOverlayMiddleware())
devServer.app.use(errorOverlayMiddleware())
}
}
})
Expand Down

0 comments on commit d795c82

Please sign in to comment.