Reputation: 285
I've created a simple project to which I want to link 3 files: angular.min.js
, bootstrap.min.js
and app.js
like in the picture below:
This looks ok, no warnings. If I press Run while in index.html the following errors appear:
In order for the errors to disappear I have to place the name of the project (NewOne) before each file I reference in index.html
. Ex: ... src=/NewOne/angular/angular.min.js ...
This generates warnings and disables the ⌘+click shortcut to go the that file.
What is the correct way to specify absolute paths in WebStorm?
Upvotes: 1
Views: 1393
Reputation: 33
With WebStorm version 2019.2 i did the following:
1 Edit in your windows hosts file the following entries:
127.0.0.1 localhost
127.0.0.1 MyProject
2 Go in Webstorm to "File -> Settings -> Build, Execution, Deployment -> Deployment" and add a new deployment location as type "in place". In the field "Web server URL:" you have to input "http://MyProject:63342/". Click Apply and it should work.
Now the following URLs should be working:
http://localhost:63342/MyProject/index.html -> uses relatie paths
http://MyProject:63342/index.html -> uses absolute paths
Please be aware that the port 63342 is the standard port of Webstorm. Maybe you have to change it to your specific port.
Upvotes: 1