Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way for me to require dependency inside chrome dev tool console?

I am using chrome dev tool console to debug my web application. I can write some javascript code on the console but I can't write something like const _ = require('lodash'). I wonder whether how I can make require work on console.

like image 987
Joey Yi Zhao Avatar asked Oct 21 '25 11:10

Joey Yi Zhao


1 Answers

You could copy-paste the source code of the Lodash library into a Snippet.

Lodash Snippet

Whenever you want to use Lodash on a page, you run the Snippet. After that, the Snippet is available under window._.

Lodash in the Console

like image 51
Kayce Basques Avatar answered Oct 24 '25 00:10

Kayce Basques