Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Intellij debug javascript code served by a local web server

I am familiar with using IntelliJ integrated JavaScript debugging to debug JavaScript files.

However, in the web browser the start address is always file-based as in :

file:///W:/WORK/JQueryClient/src/index.html

I'm working on an application which is making REST calls to my own web server. So if I start from a file address it won't work because of cross domain issues. (I can't use JSONP because I will be using PUT and POST in addition to GET , and besides the deployed application will serve up everything from the same domain, I want to code the application identically to the development world).

In Chrome or Firefox I simply get round this by pointing at my web server

http://localhost:50036/src/index.html

Here the files served up by my web server are my own local files.

Is there anyway I can configure IntelliJ to start at local host in place of a file address?

like image 589
Tony Eastwood Avatar asked Dec 11 '25 08:12

Tony Eastwood


1 Answers

Sure you can - you need using the JavaScript Remote debug configuration, set your 'http://localhost:50036/src/index.html' as 'URL to open' and specify remote URL mapping for your project folder (usually it's your web server root url + web path on server) See http://wiki.jetbrains.net/intellij/Remote_JavaScript_debugging_with_WebStorm_and_PHPStorm#Installing_and_configuring_Apache_Web_server for more info

Note that as of WebStorm 7 there is only one run configuration for JS debugging, and the run configuration created from right-click menu (action "Create/Debug" html file) uses the url on built-in http server instead of file url

like image 102
lena Avatar answered Dec 12 '25 22:12

lena



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!