Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better graceful stop for --hot 馃敟 #206

Open
1 task done
Antonio-Laguna opened this issue Jun 7, 2022 · 2 comments
Open
1 task done

Better graceful stop for --hot 馃敟 #206

Antonio-Laguna opened this issue Jun 7, 2022 · 2 comments

Comments

@Antonio-Laguna
Copy link
Member

Is your enhancement related to a problem? Please describe.

Hot is great for development and helps a lot during development. There're times thought in which you might want to save resources from watching, it could be because you're joining a call or compiling a kernel but then the stop here:

process.on('SIGINT', () => {
// when gracefully leaving hot mode, clean up dist folder.
// this avoids leaving js code with the fast refresh instrumentation and thus reducing confusion
console.log('\n10up-toolkit: Cleaning up dist folder...');
fs.rmSync(fromProjectRoot('dist'), { recursive: true, force: true });
});

Will kill the whole dist folder which leaves your site broken.

This is generally something we want. By doing this, we avoid constant polling but at the same time, we get a potentially broken site which is mitigated by doing an extra npm run build afterward.

It has happened that I've stopped the build, joined a call to do a demo, and... had to do a build right after that. I can get used to it definitely but I thought about discussing if we want to just launch a last one build.

The drawback to this is that you get a slight delay when closing. I see 3 options if we end up adding this:

  • Ignore the delay and move on with it
  • Furiously repeat CTRL+C so you avoid both the dist removal and the build from happening
  • Add yet another option that enables this behavior

Before doing anything else I wonder what other people think about this scenario as, perhaps, it's just something that has bothered me and no one else.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@fabiankaegy
Copy link
Member

I had a chat with @Antonio-Laguna about this in Slack. Essentially we agreed on the fact that even right now stopping the watch mode with the --hot flag takes ages and feels like something is stuck in an infinite loop. I'm not concerned about prolonging the shutdown time with these enhancements.

Instead, I would love us to showcase to the user what is currently happening with some better status indications.

@nicholasio
Copy link
Member

I'm fine with running a build after shutting down hot mode. I agree that showing what's going on would be ideal. Something along the lines of "cleaning up HMR and rebuilding". I think it would be good to have a better output than just a simple console.log (using colors perhaps).

We can even say something like "press CTRL+C again to stop immediatelly (this will result in a broken build)"

@nicholasio nicholasio added the Good First Issue Good for newcomers label Jul 26, 2022
@ajmaurya99 ajmaurya99 self-assigned this Jul 26, 2022
@ajmaurya99 ajmaurya99 removed their assignment Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants