plasmo icon indicating copy to clipboard operation
plasmo copied to clipboard

[RFC] piping all console to a centralized place in development

Open Karniej opened this issue 3 years ago • 4 comments

How do you envision this feature/change to look/work like?

Whenever you click inspect on the Popup window, it should be available all the time. There's no need to open it once again after making small changes in the code and saving it. Also If there could be a "server tab" opened like in React Native, where all the logs would be visible, this is fine too.

What is the purpose of this change/feature? Why?

Every time I make a small change in the code, the Popup page refreshes and the console window closes. It's hard to debug anything this way.

(OPTIONAL) Example implementations

No response

(OPTIONAL) Contact Details

[email protected]

Verify canary release

  • [X] I verified that the issue exists in plasmo canary release

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct
  • [X] I checked the current issues for duplicate problems.

Karniej avatar Sep 09 '22 10:09 Karniej

I think piping the log back to either the watcher console or into a page like expo would be nice.

I wonder if the reloading is caused due to our popup.js generates a new hash (?) or due to the chrome runtime reload we're using to do hot reload (?)...

Piping console is likely most long-term solution tho

louisgv avatar Sep 10 '22 04:09 louisgv

The piping is possible by introducing a middle-man runtime at the parcel runtime level, replacing all console log within the bundle code with a call to the internal websocket server. That should definitely work - once the console piping is done, then it should be trivial to deal with the log data either on a dashboard or just throw it on the main terminal runner for now, maybe behind a flag.

louisgv avatar Sep 10 '22 04:09 louisgv

As long as I can read the logs they can be shown anywhere. The best would be to have it in the console, but the terminal is fine too.

@louisgv And I think the answer to your question is yes. I think that reloading is caused to generating a new hash every time.

Karniej avatar Sep 14 '22 08:09 Karniej

As long as I can read the logs they can be shown anywhere. The best would be to have it in the console, but the terminal is fine too.

@louisgv And I think the answer to your question is yes. I think that reloading is caused to generating a new hash every time.

Yeah the main problem with using the console is that it is controlled by chrome process. I think this is the key reason why Expo piped all their log and show it with their own console UI, unlike Cordova/Phonegap where they relied on the chrome remote console, which would lose information the moment they disconnect xD

louisgv avatar Sep 14 '22 13:09 louisgv

Since the fix in #255 , this issue prioritization could be lower now imo - we now have actual HMR for react, thus the popup inspector will not close.

louisgv avatar Oct 08 '22 19:10 louisgv