Skip to content

What are the equivalent of webpack-serve's "on" hooks? #1509

Description

@marcofugaro

Sorry if this is a question, but I can't find a solution.

I found myself migrating back to webpack-dev-server after webpack-serve was deprecated. I found really useful to attach hooks in the webpack.config.js without having to touch node at all.

The hooks I used were on.listening, on.build-finished, on.compiler-error to show custom stats to the console. What are the equilvalent hooks in webpack-dev-server? I only found after that could substitute the on.listening, how do I attach hooks to the remaining two events, without having to run webpack from node?

Another thing I was doing:

on: {
  listening: ({ server, options }) => {
    // try to open into the already existing tab
    openBrowser(`http://localhost:${options.port}`)
  },
},

How do I do this in webpack-dev-server? How do I get the port from the arguments in after?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions