web-infra-dev / rspress

🦀💨 A fast Rspack-based static site generator.
https://rspress.dev
MIT License
1.19k stars 107 forks source link

[Bug]: failed to exit by ctrl + c after modifying _meta.json #1209

Closed yuyutaotao closed 2 days ago

yuyutaotao commented 3 days ago

Version

System:
    OS: macOS 14.3
    CPU: (12) arm64 Apple M3 Pro
    Memory: 5.88 GB / 36.00 GB
    Shell: 3.2.57 - /bin/bash
  Browsers:
    Chrome: 126.0.6478.116
    Safari: 17.3
  npmPackages:
    rspress: ^1.24.0 => 1.25.0

Details

CleanShot 2024-06-26 at 10 13 58@2x

Reproduce link

-

Reproduce Steps

Timeless0911 commented 3 days ago

This issue seems not to be reproduced stably, I tried several times, and can't reproduce it.

I guess it is related to https://github.com/web-infra-dev/rspress/blob/54be7c8b9176bcd92a393289fe5eee88540c744b/packages/cli/src/index.ts#L76-L107, graceful shutdown is something more complicated than we think.

Timeless0911 commented 2 days ago

When we modify _meta.json or shutdown using ctrl + c, the dev server will be restarted, including the steps of restarting webpack dev middleware. When the watched project's node_modules is too large, there is a problem that the close time is particularly long in watchpack maybe.

We can config in rspress.config like below

builderConfig: {
  tools: {
    rspack: {
      watchOptions: {
        ignored: /node_modules/,
      },
    },
  },
},

see https://www.rspack.dev/config/watch#watchoptions

or

we can config tranformImport to on-demand import.