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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default clearScreen to false #2820

Open
anonimusprogramus opened this issue Apr 22, 2019 · 15 comments
Open

Default clearScreen to false #2820

anonimusprogramus opened this issue Apr 22, 2019 · 15 comments

Comments

@anonimusprogramus
Copy link

anonimusprogramus commented Apr 22, 2019

I use Sveltejs with Sirv and Rollup libs included as default.

Expected Behavior:

Running npm run dev should make both Sirv and Rollup output some infos to screen.

Actual Behavior:

As soon as Sirv output infos, Rollup's infos covering it.

Proposal:

Please make Rollup's clearScreen default to false.

By defaulting to false,
(1) new user won't have to strugle finding out why and adding watch: { clearScreen: false } in Rollup config.
(2) user can see what port Svelte's running.

I also have submitted this issue in Svelte Repo.

@vladshcherbin
Copy link
Contributor

While I'm not using Svelte (for now 😄), I'll also upvote this.

I also set clearScreen to false in my configs because I don't want rollup to erase logs from previous builds, they are quite useful as you can scroll and find previous info (logs, errors, debug stuff, etc).

@shellscape
Copy link
Contributor

It would seem to me that the issue lies within the Svelte config for Rollup. Would it not be prudent for that configuration to receive a minor update versus a breaking change (requiring a major version) in Rollup?

@shellscape
Copy link
Contributor

Looks like this was quasi-fixed in #2942. Please give us a ping if there are still unresolved issues.

@vladshcherbin
Copy link
Contributor

#2942 still clears screen and "let's you scroll up" to see previous logs, but they are not the same or even not working. Example on mac:

step 1) run rollup in non-watch mode and get console output:

image

step 2) now run rollup in watch mode with clearScreen: false, make a change in file and see it compiles again:

image

Now I clear console, repeat step 1, remove clearScreen config, run rollup in watch mode, see cleared screen, make changes in file and see updated cleared screen:

image

Here I can't scroll up, it doesn't show previous logs (step 1 log, first execution step).

The issue is that by default, watch mode clears screen every time and you can't find previous logs which can very useful (debug info, bundle size changes between compiling, db queries, etc).

So, the real question is do we actually need to clear previous logs or make it harded to find them between rebuilds and why? As result, svelte adds clearScreen in rollup config in project template, many devs set it too.

What about setting it to false by default and let devs set it to true or do we even need it? 🤔

@shellscape
Copy link
Contributor

Well this is damn peculiar. The character being sent for clearing the screen should allow scrolling up. You'd have to ask @Rich-Harris why clearing the screen was originally implemented, but I'd guess it was done to keep the current screen "clean," as watch+build output can get messy in a hurry.

Perhaps we should take a different approach and allow consumers to clear the screen via a plugin+hook if they'd like to, and remove clearing the screen from core altogether. Thoughts @lukastaegert ?

@vladshcherbin
Copy link
Contributor

@shellscape yeah, at first I also thought it's a good thing to have clean screen during watch, a new build - a new life 😄 Later I understood that if I need info from previous builds (see db queries, compare errors, see bundle size changes, etc) I had to stop watch mode completely, find what I need and run it again. This is how I began to add clearScreen in all my rollup configs.

On mac, cmd + K combination clears terminal, I feel it's more natural to use it because it works for every terminal command. I'm sure there should be similar combinations on linux and windows.

After creating a ton of rollup configs with clearScreen I landed here :)

@lukastaegert
Copy link
Member

The character being sent for clearing the screen should allow scrolling up

It does in some way. I think it clears the currently visible part of the screen but anything above is still scrollable; some older logs always tend to be overwritten (The logs of the last run should still be available, though; need to check again if I find time). If someone finds a good solution so that we see a clean screen but do not lose any logs ever, please make a PR. I think at the moment we roughly do what Jest does.

@vladshcherbin
Copy link
Contributor

@lukastaegert how about setting clearScreen to false until a good enough working solution would be found? This screen clearing has been working strange for a long time, produced a quite a few issues and still has some. What do you think? 🤔

@akauppi
Copy link

akauppi commented Dec 13, 2019

Came here as a Svelte newbie. I cannot say whether the change should be in Svelte / Rollup side, but the current behaviour does feel strange, especially since it seems I cannot completely opt-out of the screen clearing, can I?

@johndunderhill
Copy link

This is highly annoying--it erases output that might be important. You don't need to clear the screen. The option to suppress this behavior doesn't work. I vote to not clear the screen.

@johndunderhill
Copy link

Pardon me, it was sirv that was doing this, in Svlete, which uses both rollup and sirv by default. You can pass --no-clear to sirv (undocumented) to stop the behavior:

sirv public --no-clear

@jonathonadams
Copy link

Pardon me, it was sirv that was doing this, in Svlete, which uses both rollup and sirv by default. You can pass --no-clear to sirv (undocumented) to stop the behavior:

sirv public --no-clear

This!!

Your'e a life saver. My issue was also caused by sirv

@givebk-bot
Copy link

Hey! Looks like someone invited me to this issue.

@antl3x
Copy link

antl3x commented May 13, 2022

@givebk-bot !donate @johndunderhill $1

thanks for your solution ❤️

@givebk-bot
Copy link

givebk-bot commented May 13, 2022 via email

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

9 participants