Output to Chrome console from Node.js

前端 未结 6 985
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 16:40

I\'m looking for a way to output Node variables directly into the google chrome browser console. The same way a console.log() works on the client side. Somethin

6条回答
  •  天涯浪人
    2020-12-09 17:08

    I know it's an old question but came on top of my Google search so maybe somebody will find my answer useful.

    So you can use node --inspect-brk index.js

    Now, all you have to do is basically just type chrome://inspect in your Chrome address bar and click Open dedicated DevTools for Node

    In DevTools, now connected to Node, you’ll have all the Chrome DevTools features you’re used to:

    • Complete breakpoint debugging, stepping w/ blackboxing

    • Source maps for transpiled code

    • LiveEdit: JavaScript hot-swap evaluation w/ V8

    • Console evaluation with ES6 feature/object support and custom object formatting

    • Sampling JavaScript profiler w/ flamechart

    • Heap snapshot inspection, heap allocation timeline, allocation profiling

    • Asynchronous stacks for native promises

    Hope that helped.

提交回复
热议问题