Skip to content

v4 does not print when the compilation starts and ends in watch mode #1902

@jakebailey

Description

@jakebailey

Is your feature request related to a problem? Please describe.

webpack-cli 3 printed "Compilation starting..." and "Compilation finished" in watch mode. This is critical for editor support, as the editor needs to know when it's safe to perform tasks once the code has changed by tracking when the build is running. E.g. I have a launch task in VS Code that starts webpack, and VS Code will know not to proceed with running anything until the code is packed. Similarly, if stop the running process and start it again having modified the code, the editor knows to wait for webpack to finish.

Describe the solution you'd like

webpack-cli 4 should restore this behavior, otherwise the existing webpack task runners in editors like VS Code will misbehave, likely hanging as they wait for a line to be printed that will never come.

v4 has a printed line for when it's watching for changes which indicates a possible end; my impression is that it'd be the place to stick these logs (but I haven't had the time to try and find it).

Describe alternatives you've considered

Currently, I'm just using webpack-cli 3 with the webpack 5 RC, since it "works" so long as I limit myself to API elements that didn't change.

I thought about writing a plugin that would print these lines, but that seems like a hack and error prone (as I really want to know when the files are going to stop changing).

The only thing I've gotten to sort of work when I have stats disabled is to have it print the webpack version; this is printed at the end so I see "webpack 5.0.0-rc.5 compiled", which gives me at least the end of run, but isn't the full start/end pair required by VS Code.

Additional context

console.error("\nCompilation " + compilationName + " starting…\n");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions